Skip to content

refactor(@angular/build): lazy load sourcemap remapping in i18n inliner worker - #34193

Merged
clydin merged 1 commit into
angular:mainfrom
clydin:perf-lazy-sourcemap-remapping
Sep 29, 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 i18n-inliner-worker.ts, eagerly pulling in 5 packages (@ampproject/remapping and 4 sub-dependencies) upon worker initialization.

In typical workflows or when sourcemaps are not requested for inlining, remapping is never executed.

This changes the import of @ampproject/remapping to be dynamic so that it is only loaded when a file actually requires sourcemap remapping.

@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 i18n-inliner-worker.ts file to lazily load the @ampproject/remapping dependency. The eager import of remapping has been converted to a type-only import, and the module is now dynamically imported and cached only when inlineLocalize is executed. There are no review comments, so I have no feedback to provide.

@clydin clydin added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Sep 28, 2026
@clydin
clydin requested a review from alan-agius4 September 28, 2026 20:44
@alan-agius4 alan-agius4 added 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 29, 2026
@alan-agius4
alan-agius4 force-pushed the perf-lazy-sourcemap-remapping branch from 9bc35b1 to f849fcb Compare September 29, 2026 08:13
…er worker

Previously, `@ampproject/remapping` was statically imported at the top level
of `i18n-inliner-worker.ts`, eagerly pulling in 5 packages
(`@ampproject/remapping` and 4 sub-dependencies) upon worker initialization.

In typical workflows or when sourcemaps are not requested for inlining,
remapping is never executed.

This changes the import of `@ampproject/remapping` to be dynamic so that
it is only loaded when a file actually requires sourcemap remapping.
@clydin
clydin force-pushed the perf-lazy-sourcemap-remapping branch from f849fcb to 519e019 Compare September 29, 2026 14:22
@alan-agius4 alan-agius4 added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Sep 29, 2026
@clydin
clydin merged commit 65c105b into angular:main Sep 29, 2026
40 checks passed
@clydin

clydin commented Sep 29, 2026

Copy link
Copy Markdown
Member Author

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

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: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants