dev-server: es2016 prebundle target for zone.js apps lowers private fields and breaks dependencies
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 48/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- angular, babel, node.js, typescript
- 領域
- build-system
研究方向
Start by tracing the dev-server dependency prebundle configuration changed in #33772 and how its es2016 target is applied to zone.js apps; the issue does not name the relevant files or tests. Compare the existing Babel linker step and Rolldown target behavior, then run the provided ix-modal reproduction with zone.js. Done when prebundling lowers async/await without lowering unrelated syntax such as private fields, and the modal can be cancelled without the ReferenceError.
由索引模型根據 Issue 內容生成。
描述
Command
serve
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
22.0.1
Description
Since #33772 (22.1.4), the dev server prebundles dependencies with an es2016 target for zone.js apps, so async/await gets lowered (#33770). But rolldown can't lower only async/await like esbuild's supported: { 'async-await': false } did. With es2016, it lowers everything newer, including private fields.
That hits an oxc bug: when a static private field is lowered, the helper references the class by name, and if the method has a local with the same name, it reads the local in its TDZ. Minified libraries hit this easily, because the minifier reuses t for both. In our case iX modals can't be closed anymore in ng serve. Production is fine, since it doesn't prebundle and esbuild only lowers async/await.
The oxc bug itself: https://github.com/oxc-project/oxc/issues/27376
I know the actual bug is in oxc, but every zone.js app now runs all its dependencies through a much bigger transform in dev than in production, which is how we ran into it. It'd be great if the prebundle could only lower async/await again. One idea: the prebundle already runs Angular's Babel step for the linker, so @babel/plugin-transform-async-to-generator could do it there and rolldown could keep the real browser targets. I didn't test that though.
Minimal Reproduction
https://github.com/felix-eschey/ix-modal
git clone https://github.com/felix-eschey/ix-modal && cd ix-modal
npm ci
npm run broken # ng serve on http://localhost:4300 with zone.js
Open http://localhost:4300, click "Open modal" and then Cancel. The modal stays open and the console shows the ReferenceError. npm run working is the same app without zone.js and works. npm run excluded keeps zone.js but excludes iX from prebundle and works too.
Exception or Error
ReferenceError: Cannot access 't' before initialization
at t$8.ensureCache (p-BqeSHO6C.js:1:304)
at get mediumTime (p-BqeSHO6C.js:1:1189)
Your Environment
Angular CLI : 22.1.7
Angular : 22.1.6
Node.js : 24.18.0
Package Manager : npm 11.16.0
Operating System : linux x64
@angular/build : 22.1.7
zone.js : 0.15.1
Anything else relevant?
Workaround is prebundle: { exclude: [...] } for the affected packages. iX issue: https://github.com/siemens/ix/issues/2874
- 主要語言
- TypeScript
- 星號
- 27k
- 分支
- 11.8k
- 平均合併
- 1 天 1 小時
- 30 天內合併 PR
- 161
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
angular/angular-cli 的其他 Issue
-
area: @angular/build gemini-triaged
難度 2/5 1-3 小時 新手友好度 74/100
angular/angular-cli#33955 ·
維護者通常 1 天內回覆
-
area: @angular/cli gemini-triaged
難度 2/5 1-3 小時 新手友好度 72/100
angular/angular-cli#33055 · 1 則留言 · 3 個 reaction ·
維護者通常 1 天內回覆
-
SSR resolves relative `redirectTo` against the wrong base when the route path has several segments可能已有人在做 @bschaeublin 於 1 天前認領。 未關閉area: @angular/ssr
難度 3/5 1-2 天 新手友好度 45/100
angular/angular-cli#34300 ·
維護者通常 1 天內回覆
-
SSR route redirects drop the query string on relative `redirectTo`可能已有人在做 @bschaeublin 於 1 天前認領。 未關閉area: @angular/ssr
難度 3/5 1-2 天 新手友好度 45/100
angular/angular-cli#34298 ·
維護者通常 1 天內回覆
-
area: @angular/build
難度 4/5 3-5 天 新手友好度 25/100
angular/angular-cli#34292 ·
維護者通常 1 天內回覆
查看 angular/angular-cli 的全部 Issue
相似的 Issue
-
area: desktop area: website priority: P2 type: feature
難度 2/5 1-3 小時 新手友好度 62/100
appandflow/stim#3411 · 1 則留言 ·
維護者通常 1 天內回覆
-
needs triage
難度 2/5 1-3 小時 新手友好度 65/100
rjsf-team/react-jsonschema-form#5485 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難度 1/5 1 小時以內 新手友好度 65/100
lingdojo/kana-dojo#32090 · 1 則留言 · 5 個 reaction ·
維護者通常 1 天內回覆
-
Friction: Org home and org switcher copy still say repositories and connected agents live in the personal account可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉friction
難度 2/5 1-3 小時 新手友好度 80/100
kentcdodds/kody#3265 ·
維護者通常 1 天內回覆