Localization
Angular ships per-locale data (numbers, dates, plural rules) under
@angular/common/locales. These files don't follow
standard package exports, so the share helpers can't pick them up
automatically. The Angular adapter has two ways to handle them; new
projects get the recommended one by default.
Recommended: ignoreUnusedDeps
Since adapter v20.0.6, locale data loading is automatic when
features.ignoreUnusedDeps is on:
export default withNativeFederation({
// ...
features: {
ignoreUnusedDeps: true,
},
});
The core scans your entry points and only ships the locale files you actually import — no manual list, no surprises. New v4 projects get this enabled by default.
How does it work? withNativeFederation in the Angular
adapter strips every @angular/common/locales/* entry from
the shared map when ignoreUnusedDeps is off.
With the flag on, locale entries are kept and the unused-deps shaking
does the right thing on a per-entry basis.
Fallback: shareAngularLocales
Before v20.0.6, or any time you can't enable
ignoreUnusedDeps, declare the locales explicitly:
import {
withNativeFederation,
shareAll,
shareAngularLocales,
} from '@angular-architects/native-federation-v4/config';
export default withNativeFederation({
name: 'mfe1',
shared: {
...shareAll({ singleton: true, strictVersion: true, requiredVersion: 'auto' }),
...shareAngularLocales(['en', 'de', 'fr']),
},
});
shareAngularLocales generates one shared entry per
locale, pre-wiring its package info to
node_modules/@angular/common/locales/<locale>.js.
The helper was introduced in v19.0.14.
Options
shareAngularLocales(keys: string[], opts?: {
config?: ExternalConfig;
legacy?: boolean;
})
-
keys— locale codes to share. Anything available under@angular/common/locales. -
opts.config— overrides the per-entry shared config. Defaults to{ singleton: true, strictVersion: true, requiredVersion: 'auto' }. -
opts.legacy— use the old.mjsfilenames instead of.js. Only relevant for older@angular/commonversions.
Automatic Shell Reloading
The federation dev server pushes Server-Sent Events when a remote finishes (re)building, so the shell can refresh without a manual page reload. See the Builder → Dev Server section for the wiring, and the article below for the full pattern:
Fixing DX Friction: Automatic Shell Reloading
How to subscribe to the federation build-notification stream and trigger a host reload whenever a remote rebuilds.
Read the ArticleRelated
-
I18N — Angular's
i18n+ translation pipeline integration. - Angular Config → shareAngularLocales.
-
Core configuration → features
— the canonical reference for
ignoreUnusedDeps.