fix(@angular/build): set es2016 target for Rolldown prebundling in Zone.js apps - #33772
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the Vite dev-server builder to pass the target option to Rolldown's dependency optimization configuration. Specifically, it avoids Rolldown initialization errors by replacing the target array with ['es2016'] for applications using Zone.js, rather than appending to it. The target is now correctly propagated through getDepOptimizationConfig and a new unit test has been added to verify this behavior. I have no feedback to provide as there are no review comments.
edd81a2 to
a88115f
Compare
a88115f to
e6841cd
Compare
|
Workaround for rolldown/rolldown#10633 |
e6841cd to
0cc1b63
Compare
There was a problem hiding this comment.
Code Review
This pull request implements a workaround for a Rolldown issue by explicitly setting the compilation target to ['es2022'] for zoneless applications and ['es2016'] otherwise. This target is then propagated through the Vite dev-server configuration to getDepOptimizationConfig. The only feedback is to correct a minor typo in the workaround comment.
0cc1b63 to
2af78cb
Compare
…n Vite dev server Rolldown dependency prebundling in Vite dev server did not receive target options, leaving native async/await in prebundled dependencies. When an application uses Zone.js, native async/await causes Zone.js context loss across await ticks. Additionally, passed target options are set as a single target string array as a temporary workaround for Rolldown issue angular#10633 (where multiple browser targets cause initialization errors). Fixes angular#33770
2af78cb to
3d3c113
Compare
Rolldown dependency prebundling in Vite dev server was not receiving target options, leaving native
async/awaitintact in prebundled dependencies (such as@angular/common/http'sFetchBackend). When an application uses Zone.js, nativeasync/awaitcauses Zone.js context loss across nativeawaitticks.This PR passes
targettorolldownOptions.transform.targetduring dependency optimization. For non-zoneless applications (apps using Zone.js),targetis set to['es2016']to downlevel nativeasync/awaitin prebundled dependencies.Fixes #33770