From c25614a4b8bfdf129942d2e719ce516236479f27 Mon Sep 17 00:00:00 2001 From: Aukevanoost Date: Tue, 20 Jan 2026 10:56:49 +0100 Subject: [PATCH 1/3] fix: Added legacy support --- .../src/utils/angular-locales.ts | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/libs/native-federation/src/utils/angular-locales.ts b/libs/native-federation/src/utils/angular-locales.ts index 1ebaf193..e5d3d148 100644 --- a/libs/native-federation/src/utils/angular-locales.ts +++ b/libs/native-federation/src/utils/angular-locales.ts @@ -2,20 +2,24 @@ import { share, SharedConfig } from '@softarc/native-federation/build'; export function shareAngularLocales( keys, - config: SharedConfig = { - singleton: true, - strictVersion: true, - requiredVersion: 'auto', - }, + opts: { config?: SharedConfig; legacy?: boolean }, ) { + if (!opts.config) { + opts.config = { + singleton: true, + strictVersion: true, + requiredVersion: 'auto', + }; + } + const ext = !!opts.legacy ? '.mjs' : '.js'; return keys.reduce((acc, key) => { acc[`@angular/common/locales/${key}`] = { - ...config, - packageInfo: config.packageInfo || { - ...config.packageInfo, + ...opts.config!, + packageInfo: opts.config.packageInfo || { + ...opts.config.packageInfo, entryPoint: - config.packageInfo?.entryPoint || - `node_modules/@angular/common/locales/${key}.js`, + opts.config.packageInfo?.entryPoint || + `node_modules/@angular/common/locales/${key}${ext}`, }, }; return share(acc); From 9983e21069fb242dec9309417c51f6bf6d476cab Mon Sep 17 00:00:00 2001 From: Aukevanoost Date: Tue, 20 Jan 2026 10:59:31 +0100 Subject: [PATCH 2/3] chore: Updated docs for shareAngularLocales legacy support --- libs/native-federation/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/native-federation/README.md b/libs/native-federation/README.md index 251a06f3..5327a07f 100644 --- a/libs/native-federation/README.md +++ b/libs/native-federation/README.md @@ -374,6 +374,7 @@ module.exports = withNativeFederation({ shared: { ...shareAll({ singleton: true, strictVersion: true, requiredVersion: 'auto' }), ...shareAngularLocales(['en', 'de', 'fr']), + //...shareAngularLocales(['en', 'de', 'fr'], {legacy: true}), // ng19 or older } }); ``` From af5dc21e87aebb4f5d8f6fe15456215f57b74a46 Mon Sep 17 00:00:00 2001 From: Aukevanoost Date: Tue, 20 Jan 2026 11:11:34 +0100 Subject: [PATCH 3/3] fix: PR review --- libs/native-federation/src/utils/angular-locales.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/native-federation/src/utils/angular-locales.ts b/libs/native-federation/src/utils/angular-locales.ts index e5d3d148..9824e9af 100644 --- a/libs/native-federation/src/utils/angular-locales.ts +++ b/libs/native-federation/src/utils/angular-locales.ts @@ -1,8 +1,8 @@ import { share, SharedConfig } from '@softarc/native-federation/build'; export function shareAngularLocales( - keys, - opts: { config?: SharedConfig; legacy?: boolean }, + keys: string[], + opts: { config?: SharedConfig; legacy?: boolean } = {}, ) { if (!opts.config) { opts.config = { @@ -11,7 +11,7 @@ export function shareAngularLocales( requiredVersion: 'auto', }; } - const ext = !!opts.legacy ? '.mjs' : '.js'; + const ext = opts.legacy ? '.mjs' : '.js'; return keys.reduce((acc, key) => { acc[`@angular/common/locales/${key}`] = { ...opts.config!,