From e9fa106794123e076689a7fd4ab9781cf4ff2ad4 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Thu, 23 Jun 2022 11:36:56 +0000 Subject: [PATCH] fix(@angular-devkit/build-angular): ignore supported browsers during i18n extraction Since extraction doesn't work on the browser we can ignore the `supportedBrowsers` configuration during message extraction. Closes #23420 --- .../angular_devkit/build_angular/src/babel/webpack-loader.ts | 2 +- .../build_angular/src/builders/extract-i18n/index.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/angular_devkit/build_angular/src/babel/webpack-loader.ts b/packages/angular_devkit/build_angular/src/babel/webpack-loader.ts index aa2845fd666e..14b0e817da8b 100644 --- a/packages/angular_devkit/build_angular/src/babel/webpack-loader.ts +++ b/packages/angular_devkit/build_angular/src/babel/webpack-loader.ts @@ -125,7 +125,7 @@ export default custom(() => { customOptions.forcePresetEnv = true; // Comparable behavior to tsconfig target of ES5 customOptions.supportedBrowsers = ['IE 9']; - } else if (isJsFile) { + } else if (isJsFile && customOptions.supportedBrowsers?.length) { // Applications code ES version can be controlled using TypeScript's `target` option. // However, this doesn't effect libraries and hence we use preset-env to downlevel ES fetaures // based on the supported browsers in browserlist. diff --git a/packages/angular_devkit/build_angular/src/builders/extract-i18n/index.ts b/packages/angular_devkit/build_angular/src/builders/extract-i18n/index.ts index ebecd06f9211..2c14aba79659 100644 --- a/packages/angular_devkit/build_angular/src/builders/extract-i18n/index.ts +++ b/packages/angular_devkit/build_angular/src/builders/extract-i18n/index.ts @@ -233,6 +233,8 @@ export async function execute( return partials; }, + // During extraction we don't need specific browser support. + { supportedBrowsers: undefined }, ); // All the localize usages are setup to first try the ESM entry point then fallback to the deep imports.