refactor(@angular/build): lazy load sourcemap remapping in js transform worker - #34191
Merged
Merged
Conversation
…rm worker Previously, `@ampproject/remapping` was statically imported at the top level of `javascript-transformer-worker.ts`, eagerly pulling in 5 packages (`@ampproject/remapping` and 4 sub-dependencies) upon worker initialization. In standard Angular CLI configurations (`ng build` and `ng serve`), vendor sourcemaps are disabled by default (`thirdPartySourcemaps = false`), causing `useInputSourcemap` to evaluate to false for all transformed `node_modules` files. As a result, sourcemap remapping is never executed in typical builds.
There was a problem hiding this comment.
Code Review
This pull request refactors the @ampproject/remapping import in javascript-transformer-worker.ts to be loaded lazily. The top-level import is converted to a type-only import, and the module is dynamically imported and cached only when it is needed. I have no feedback to provide as there are no review comments.
alan-agius4
approved these changes
Sep 28, 2026
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously,
@ampproject/remappingwas statically imported at the top level ofjavascript-transformer-worker.ts, eagerly pulling in 5 packages (@ampproject/remappingand 4 sub-dependencies) upon worker initialization.In standard Angular CLI configurations (
ng buildandng serve), vendor sourcemaps are disabled by default (thirdPartySourcemaps = false), causinguseInputSourcemapto evaluate to false for all transformednode_modulesfiles. As a result, sourcemap remapping is never executed in typical builds.