Skip to content

fix(@angular/build): prevent externalizing builder-injected i18n locale data#33523

Merged
clydin merged 1 commit into
angular:mainfrom
clydin:fix/i18n-locale-external
Jul 8, 2026
Merged

fix(@angular/build): prevent externalizing builder-injected i18n locale data#33523
clydin merged 1 commit into
angular:mainfrom
clydin:fix/i18n-locale-external

Conversation

@clydin

@clydin clydin commented Jul 7, 2026

Copy link
Copy Markdown
Member

When a user externalizes @angular/common using the externalDependencies option, esbuild's wildcard external rule also marks any paths under @angular/common/* as external.

This causes the builder-injected locale data imports (@angular/common/locales/global/<code>) inside the polyfills bundle to be externalized as bare imports, which fails at runtime because these files are not emitted as standalone public assets.

…le data

When a user externalizes `@angular/common` using the `externalDependencies` option, esbuild's wildcard external rule also marks any paths under `@angular/common/*` as external.

This causes the builder-injected locale data imports (`@angular/common/locales/global/<code>`) inside the polyfills bundle to be externalized as bare imports, which fails at runtime because these files are not emitted as standalone public assets.
@clydin clydin added the target: patch This PR is targeted for the next patch release label Jul 7, 2026

@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 ensures that builder-injected i18n locale-data imports are not externalized, even when @angular/common is marked as an external dependency. It updates execute-build.ts to prevent externalizing dependencies starting with LOCALE_DATA_BASE_MODULE, refactors i18n-locale-plugin.ts to use createProjectResolver instead of createRequire to resolve locale paths locally, and adds a new integration test to verify this behavior. There are no review comments, so I have no feedback to provide.

@clydin clydin requested a review from alan-agius4 July 7, 2026 15:15
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jul 7, 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 8, 2026
@clydin clydin merged commit 85c53d9 into angular:main Jul 8, 2026
70 of 71 checks passed
@clydin

clydin commented Jul 8, 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 fix/i18n-locale-external branch July 8, 2026 14:49
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.

Self-injected i18n locale-data import is classified as an explicit external and breaks apps that externalize @angular/common

2 participants