Skip to content

Commit ad5e1bb

Browse files
clydindgp1130
authored andcommitted
fix(@angular-devkit/build-angular): only remove localize polyfill if in AOT mode
Fixes: #16890 (cherry picked from commit 3c771d1)
1 parent 7f0b9b6 commit ad5e1bb

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

packages/angular_devkit/build_angular/src/utils/webpack-browser-config.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,16 @@ export async function generateI18nBrowserWebpackConfigFromContext(
145145
const config = result.config;
146146

147147
if (i18n.shouldInline) {
148-
// Remove localize "polyfill"
149-
if (!config.resolve) {
150-
config.resolve = {};
148+
// Remove localize "polyfill" if in AOT mode
149+
if (buildOptions.aot) {
150+
if (!config.resolve) {
151+
config.resolve = {};
152+
}
153+
if (!config.resolve.alias) {
154+
config.resolve.alias = {};
155+
}
156+
config.resolve.alias['@angular/localize/init'] = require.resolve('./empty.js');
151157
}
152-
if (!config.resolve.alias) {
153-
config.resolve.alias = {};
154-
}
155-
config.resolve.alias['@angular/localize/init'] = require.resolve('./empty.js');
156158

157159
// Update file hashes to include translation file content
158160
const i18nHash = Object.values(i18n.locales).reduce(

0 commit comments

Comments
 (0)