Skip to content

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

Open
clydin wants to merge 1 commit into
angular:mainfrom
clydin:fix/i18n-locale-external
Open

fix(@angular/build): prevent externalizing builder-injected i18n locale data#33523
clydin wants to merge 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
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 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

1 participant