fix(aot): a user binding named `i0` collides with the injected `import * as i0 from '@angular/core'`
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- angular, rust, typescript
- 领域
- compilers
调研方向
Start with crates/oxc_angular_compiler/src/component/namespace_registry.rs and compare its alias selection with the JIT handling from #504. Trace the hard-coded i0 uses in class_metadata/compiler.rs and component/transform.rs, including the HMR dependency and emitted import. Done means each file chooses one free namespace alias and the repros no longer produce duplicate bindings or refer to the user's i0.
由索引模型根据 Issue 内容生成。
描述
In AOT output, OXC always adds import * as i0 from '@angular/core' and refers to it as i0. If the file already has a top-level i0, the output declares it twice (a SyntaxError), and the Ivy code may use the user's i0. ngtsc picks a free name (i0_1). #504 fixed this for the JIT path by choosing a free name. AOT still uses a fixed name.
Repro A
import {Component} from '@angular/core';
const i0 = 1;
@Component({selector: 'c', template: '<div>{{v}}</div>'})
export class C { v = i0; }
Repro B
import {Component} from '@angular/core';
import * as i0 from './other';
@Component({selector: 'c', template: '<div>{{v}}</div>'})
export class C { v = i0.x; }
OXC (main and #504 tip)
import {Component} from '@angular/core';
import * as i0 from '@angular/core';
const i0 = 1; // duplicate declaration
export class C { v = i0;
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({...
import * as i0 from './other';
import * as i0 from '@angular/core'; // duplicate import binding
ngtsc 22.1.7
import * as i0_1 from "@angular/core";
const i0 = 1;
export class C {
v = i0;
static ɵcmp = /*@__PURE__*/ i0_1.ɵɵdefineComponent({ ... i0_1.ɵɵtext(1); ...
(B: import * as i0 from './other'; import * as i0_1 from "@angular/core";)
Where
i0 is hard-coded in several places:
crates/oxc_angular_compiler/src/component/namespace_registry.rs(@angular/core→i0; theiNnames for other modules have the same problem)class_metadata/compiler.rs(ReadVarExpr { name: "i0" })component/transform.rs(HMR namespace dependency, and the emitted import)
On main?
Yes. #504 only fixes the JIT path (JIT_ANGULAR_CORE_NS, commit 5128879).
Direction
Pick the namespace alias once per file, avoiding top-level bindings (as #504 does for JIT and as ngtsc's ImportManager does), and pass it to every place that emits the namespace.
- 主要语言
- Rust
- 星标
- 232
- 派生
- 21
- 平均合并
- 1 天 16 小时
- 30 天内合并 PR
- 62
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
voidzero-dev/oxc-angular-compiler 的其他 Issue
-
bug
难度 4/5 3-5 天 新手友好度 68/100
voidzero-dev/oxc-angular-compiler#505 ·
维护者通常 1 天内回复
-
bug rust
难度 4/5 3-5 天 新手友好度 56/100
voidzero-dev/oxc-angular-compiler#313 ·
维护者通常 1 天内回复
-
Support useDefineForClassFields: false (Class Field Lowering)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 5/5 一周以上 新手友好度 35/100
voidzero-dev/oxc-angular-compiler#73 · 11 条评论 ·
维护者通常 1 天内回复
-
Angular 21.2.0 + @oxc-angular/vite 0.0.7 SSR runtime parity regressions (RouterLinkActive, Forms DI, Apollo DI) require app-level shims可能重新可做 @Brooooooklyn 于 218 天前认领,目前没有进行中的 PR。 未关闭
voidzero-dev/oxc-angular-compiler#61 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Angular 21.2.0 + @oxc-angular/vite 0.0.7 SSR: AngularNodeAppEngine is unusable (missing app-engine manifest)可能重新可做 @Brooooooklyn 于 218 天前认领,目前没有进行中的 PR。 未关闭
voidzero-dev/oxc-angular-compiler#60 · 4 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 voidzero-dev/oxc-angular-compiler 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
pact-foundation/pact-cli#154 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
antithesishq/bombadil#361 ·
维护者通常 1 天内回复
-
test(executor_l0): assert execute() TaskOutcome, not only bus events / 断言 execute() 返回的 TaskOutcome未关闭type:debt
难度 2/5 1-3 小时 新手友好度 62/100
skaiy/wild_agentos#425 ·
维护者通常 1 天内回复
-
Default-import note suggests `import * as process` for velt:process, which does not name the builtin未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
bug ticket
难度 2/5 1-3 小时 新手友好度 72/100
cratestack/cratestack#1154 ·
维护者通常 1 天内回复