Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

@defer doesn't lazy-load an imports entry written as forwardRef(() => X)

オープン
#632 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@edbzn がすでに取り組んでいます。

2026年10月25日 から。

  • #640 @edbzn による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
rust, typescript
領域
compilers

調査の方向性

Start in compile_component_full and inspect the implicit-deferral gate and identifier matching for @Component.imports; compare how ngtsc resolves forwardRef through forwardRefResolver. Run the ngtsc defer_spec.ts case “should lazy-load dependency referenced with a fowardRef” against oxc with cross-file analysis enabled and resolveImportedValues: true. Done means the generated output uses a defer dependency function with a dynamic import and no static CmpA import; an open pull request (#640) is already linked.

索引モデルが issue の本文から書いたものです。

説明

Summary

A standalone component listed in @Component.imports through forwardRef(() => X) and used only inside @defer is not lazy-loaded: the static import stays and ɵɵdefer gets no dependency function, so the component ships in the main chunk. A plain imports: [X] entry is deferred correctly (#313). Found by running Angular's ngtsc spec defer_spec.ts: "should lazy-load dependency referenced with a fowrardRef" against oxc (cross-file analysis on, resolveImportedValues: true).

Reproduction

// cmp-a.ts
import {Component} from '@angular/core';
@Component({selector: 'cmp-a', template: 'CmpA!'})
export class CmpA {}

// test.ts
import {Component, forwardRef} from '@angular/core';
import {CmpA} from './cmp-a';

@Component({
  selector: 'test-cmp',
  imports: [forwardRef(() => CmpA)],
  template: `@defer { <cmp-a /> }`,
})
export class TestCmp {}
Actual
import { CmpA } from './cmp-a';
...
i0.ɵɵdefer(1, 0);
...
dependencies: i0.ɵɵgetComponentDepsFactory(TestCmp, [forwardRef(() => CmpA)])
Expected (ngc)
const TestCmp_Defer_1_DepsFn = () => [import("./cmp-a").then(m => m.CmpA)];
...
i0.ɵɵdefer(1, 0, TestCmp_Defer_1_DepsFn);

and no import { CmpA }.

Cause

The implicit-deferral gate in compile_component_full only runs when every imports entry is a bare identifier, and the identifier list it matches against skips forwardRef(...) entries; ngtsc resolves them through forwardRefResolver first.

主要言語
Rust
スター
244
フォーク
26
平均マージ
1日 16分
マージ済み PR(30日)
87

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

voidzero-dev/oxc-angular-compiler のほかの issue

voidzero-dev/oxc-angular-compiler の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。