Skip to content

Commit 7a6a17d

Browse files
author
claudio-roma
committed
fix(@angular/build): builder removes @angular/localize when script optimization is disabled
1 parent c3c9ac5 commit 7a6a17d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/angular/build/src/tools/esbuild/application-code-bundle.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,12 @@ function getEsBuildCommonPolyfillsOptions(
671671
// Locale data should go first so that project provided polyfill code can augment if needed.
672672
let needLocaleDataPlugin = false;
673673
if (i18nOptions.shouldInline) {
674-
// Remove localize polyfill as this is not needed for build time i18n.
675-
polyfills = polyfills.filter((path) => !path.startsWith('@angular/localize'));
674+
const isOptimizedBuild = options.optimizationOptions.scripts;
675+
if (isOptimizedBuild) {
676+
// Remove localize polyfill where script optimizations are enabled
677+
// and therefore, i18n inlining transform has occurred.
678+
polyfills = polyfills.filter((path) => !path.startsWith('@angular/localize'));
679+
}
676680

677681
// Add locale data for all active locales
678682
// TODO: Inject each individually within the inlining process itself

0 commit comments

Comments
 (0)