diff --git a/packages/webpack/src/utils/with-nx.ts b/packages/webpack/src/utils/with-nx.ts index a05023af6a562..b7e1616117216 100644 --- a/packages/webpack/src/utils/with-nx.ts +++ b/packages/webpack/src/utils/with-nx.ts @@ -20,6 +20,18 @@ import browserslist = require('browserslist'); const VALID_BROWSERSLIST_FILES = ['.browserslistrc', 'browserslist']; +const ES5_BROWSERS = [ + 'ie 10', + 'ie 11', + 'safari 11', + 'safari 11.1', + 'safari 12', + 'safari 12.1', + 'safari 13', + 'ios_saf 13.0', + 'ios_saf 13.3', +]; + function getTerserEcmaVersion(projectRoot: string) { let pathToBrowserslistFile = ''; for (const browserslistFile of VALID_BROWSERSLIST_FILES) { @@ -36,7 +48,7 @@ function getTerserEcmaVersion(projectRoot: string) { const env = browserslist.loadConfig({ path: pathToBrowserslistFile }); const browsers = browserslist(env); - return browsers.includes('ie 11') ? 5 : 2020; + return browsers.some((b) => ES5_BROWSERS.includes(b)) ? 5 : 2020; } const IGNORED_WEBPACK_WARNINGS = [