Skip to content

feat(@angular/build): migrate i18n inliner to oxc-parser + magic-string#33601

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
clydin:feat/i18n-oxc-transformer
Jul 20, 2026
Merged

feat(@angular/build): migrate i18n inliner to oxc-parser + magic-string#33601
alan-agius4 merged 1 commit into
angular:mainfrom
clydin:feat/i18n-oxc-transformer

Conversation

@clydin

@clydin clydin commented Jul 17, 2026

Copy link
Copy Markdown
Member

This refactors the i18n translation and locale inlining in the ESBuild pipeline to use oxc-parser and magic-string instead of @babel/core.

By using the lightweight AST and precise token spans provided by OXC, we are able to perform $localize inlining and locale name replacements via targeted magic-string overwrites in-place. This completely removes the dependency on @babel/core and the custom/upstream Babel plugins in the worker, yielding faster startup times and significant compile-time speedups for localized builds.

@clydin clydin added the target: minor This PR is targeted for the next minor release label Jul 17, 2026
@angular-robot angular-robot Bot added detected: feature PR contains a feature commit area: @angular/build labels Jul 17, 2026
@clydin
clydin marked this pull request as ready for review July 17, 2026 22:51

@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 replaces Babel with OXC and Magic-String in the i18n inliner worker to optimize translation inlining. Feedback is provided regarding template literal reconstruction, where carriage returns could be normalized to line feeds and corrupt translations; a suggestion is made to use JSON.stringify for robust escaping.

Comment thread packages/angular/build/src/tools/esbuild/i18n-inliner-worker.ts Outdated
This refactors the i18n translation and locale inlining in the ESBuild pipeline to use `oxc-parser` and `magic-string` instead of `@babel/core`.

By using the lightweight AST and precise token spans provided by OXC, we are able to perform `$localize` inlining and locale name replacements via targeted `magic-string` overwrites in-place. This completely removes the dependency on `@babel/core` and the custom/upstream Babel plugins in the worker, yielding faster startup times and significant compile-time speedups for localized builds.
@clydin
clydin force-pushed the feat/i18n-oxc-transformer branch from cc6d3a3 to 29fb055 Compare July 17, 2026 22:56
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jul 17, 2026
@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 Jul 20, 2026
@alan-agius4
alan-agius4 merged commit 917393a into angular:main Jul 20, 2026
41 checks passed
@alan-agius4

Copy link
Copy Markdown
Collaborator

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 detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

esbuild application builder is significantly slower than webpack with many locales

2 participants