fix(native-federation): resolve @angular/common/locales/global/<code>…#1107
Open
ValentinBossi wants to merge 1 commit into
Open
Conversation
… bare specifier Angular's @angular/build:application builder injects a polyfill `angular:locale/data:<sourceLocale>` whenever `i18n.sourceLocale` is explicitly defined and not en/en-US. In dev-server mode with `packages: 'external'`, the i18n-locale-plugin leaves the resulting `@angular/common/locales/global/<code>` import as a bare specifier so vite's dep-prebundling can resolve it at runtime. Native Federation replaces vite's externals/prebundling with its own importmap (via es-module-shims), but did not surface the locale data file there. The browser therefore failed to resolve the bare specifier with "Failed to resolve module specifier '@angular/common/locales/global/<code>'". Inject the matching locale data files as shared chunks into the federation config after normalization (so filterShared does not strip them again), so the bundler emits the files and writeImportMap lists them. Mirrors Angular's progressive locale-tag fallback (de-XYZ -> de). Also covers the dev-server case where a single inline locale is served via the --localize filter. https://claude.ai/code/session_01R6oaYzTRcwyo5JUWGqWZHv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… bare specifier
Angular's @angular/build:application builder injects a polyfill
angular:locale/data:<sourceLocale>wheneveri18n.sourceLocaleis explicitly defined and not en/en-US. In dev-server mode withpackages: 'external', the i18n-locale-plugin leaves the resulting@angular/common/locales/global/<code>import as a bare specifier so vite's dep-prebundling can resolve it at runtime.Native Federation replaces vite's externals/prebundling with its own importmap (via es-module-shims), but did not surface the locale data file there. The browser therefore failed to resolve the bare specifier with "Failed to resolve module specifier
'@angular/common/locales/global/
'".Inject the matching locale data files as shared chunks into the federation config after normalization (so filterShared does not strip them again), so the bundler emits the files and writeImportMap lists them. Mirrors Angular's progressive locale-tag fallback (de-XYZ -> de).
Also covers the dev-server case where a single inline locale is served via the --localize filter.
https://claude.ai/code/session_01R6oaYzTRcwyo5JUWGqWZHv