Repository navigation
refactor(@angular/build): optimize JavaScript transformer worker startup and sourcemap generation - #33980
Conversation
There was a problem hiding this comment.
Code Review
This pull request optimizes dynamic imports in the JavaScript transformer worker by grouping them using Promise.all and updates the source map generation options in the OXC transformer to use 'boundary' instead of true for hires. The review feedback suggests caching the dynamically imported Babel linker dependencies at the module level to avoid the overhead of repeatedly calling import() and creating new promises on every file transformation.
… worker By default, JavaScript transformations use the native OXC engine for Angular linking and advanced optimizations. The Babel-based linker is only utilized when the NG_BUILD_BABEL_LINKER environment variable is explicitly enabled. Previously, transformAsync was imported statically at the top level of javascript-transformer-worker.ts, causing Node.js to eagerly evaluate @babel/core and all its transitive dependencies on startup across every Piscina worker thread. Importing @babel/core dynamically only when the Babel linker fallback is active reduces worker thread startup latency and eliminates unnecessary worker idle memory overhead on standard builds.
…ation in oxc transform Generating high-resolution sourcemap tokens for every character with hires: true produces substantially larger intermediate decoded mappings and increases peak memory consumption during sourcemap remapping. Using hires: 'boundary' generates tokens only at identifier and word boundaries. This significantly reduces decoded sourcemap memory footprint and remapping time while retaining full debugging accuracy.
8df7a4f to
33b6676
Compare
|
This PR was merged into the repository. The changes were merged into the following branches:
|
|
This pull request has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This PR introduces two targeted performance optimizations to the JavaScript transformation pipeline:
@babel/corein transformer workers