Skip to content

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

Open
clydin wants to merge 1 commit into
angular:mainfrom
clydin:feat/i18n-oxc-transformer
Open

feat(@angular/build): migrate i18n inliner to oxc-parser + magic-string#33601
clydin wants to merge 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer 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

1 participant