dev-server: es2016 prebundle target for zone.js apps lowers private fields and breaks dependencies
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 48/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- angular, babel, node.js, typescript
- Domínio
- build-system
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- TypeScript
- Estrelas
- 27k
- Forks
- 11.8k
- Merge médio
- 1d 12min
- PRs com merge (30d)
- 171
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de angular/angular-cli
-
area: @angular/build gemini-triaged
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
angular/angular-cli#33955 ·
Mantenedores costumam responder em até 1 dia
-
area: @angular/cli gemini-triaged
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
angular/angular-cli#33055 · 1 comentário · 3 reações ·
Mantenedores costumam responder em até 1 dia
-
area: @angular/build
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
angular/angular-cli#34292 ·
Mantenedores costumam responder em até 1 dia
-
Follow-up to issue: SSR: Add a way to configure externalDependencies for the server bundle onlyAbertaarea: @angular/build
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
angular/angular-cli#34262 ·
Mantenedores costumam responder em até 1 dia
-
Vite dev server: proxy config normalization reorders glob keys, drops string `context` and misses URLs with a query stringTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertaarea: @angular/build
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 65/100
angular/angular-cli#34257 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de angular/angular-cli
Issues semelhantes
-
Mondriaan
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
knaw-huc/textannoviz#709 ·
Mantenedores costumam responder em até 1 dia
-
Add: YRF Music NepalAbertastreams:add
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia
-
About page content is also published as an unstyled duplicate at /about/about/Talvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
walletbeat/walletbeat#1558 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
hawk-digital-environments/HAWKI#438 ·
Mantenedores costumam responder em até 1 dia
-
good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
OktoLabsAI/okto-pulse#114 ·
Mantenedores costumam responder em até 1 dia