@defer doesn't lazy-load an imports entry written as forwardRef(() => X)
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
voidzero-dev/oxc-angular-compiler のほかの issue
-
vite: async/await is not lowered for zone.js, so fakeAsync/tick cannot control awaits対応中かも @edbzn が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
voidzero-dev/oxc-angular-compiler#641 ·
メンテナーはふだん 1 日以内に返信
-
Constructor param typed `ns.Foo` (namespace-qualified) compiles to ɵɵinvalidFactoryDep対応中かも @edbzn が 1 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
voidzero-dev/oxc-angular-compiler#633 ·
メンテナーはふだん 1 日以内に返信
-
Project-wide preserveWhitespaces option is ignored対応中かも @edbzn が 1 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
voidzero-dev/oxc-angular-compiler#631 ·
メンテナーはふだん 1 日以内に返信
-
Constructor overloads: factory and metadata read the first overload, not the implementation対応中かも @edbzn が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
voidzero-dev/oxc-angular-compiler#630 ·
メンテナーはふだん 1 日以内に返信
-
@Injectable deps entries written as [new Optional(), new Self(), Dep] inject the array as the token対応中かも @edbzn が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
voidzero-dev/oxc-angular-compiler#629 ·
メンテナーはふだん 1 日以内に返信
voidzero-dev/oxc-angular-compiler の issue をすべて見る
似ている issue
-
accounts bug decoding
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
wboayue/rust-ibapi#1088 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
`mise doctor` Shows Not Installed Lazy Tools as Problems対応中かも @jdx が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
area:kernel needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
bherbruck/solvecraft#7179 · コメント 1 件 ·
-
priority: medium
難易度 2/5 1〜3時間 初心者へのやさしさ 61/100
storytold/photocraft#9704 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信