Skip to content

refactor(@angular/build): lazy load sourcemap remapping in js transform worker - #34191

Merged
clydin merged 1 commit into
angular:mainfrom
clydin:perf-lazy-sourcemap-remapping
Sep 28, 2026
Merged

clydin merged 1 commit into
angular:mainfrom
clydin:perf-lazy-sourcemap-remapping

Conversation

@clydin

@clydin clydin commented Sep 28, 2026

Copy link
Copy Markdown
Member

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.

…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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Sep 28, 2026
@alan-agius4 alan-agius4 added target: patch This PR is targeted for the next patch release action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Sep 28, 2026
@clydin
clydin merged commit 36bdd84 into angular:main Sep 28, 2026
43 checks passed
@clydin

clydin commented Sep 28, 2026

Copy link
Copy Markdown
Member Author

This PR was merged into the repository. The changes were merged into the following branches:

@clydin
clydin deleted the perf-lazy-sourcemap-remapping branch September 28, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants