Skip to content

Commit

Permalink
fix(bundling): update the browsers for es5 terser check
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed Jun 26, 2023
1 parent b736992 commit 51bb80d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/webpack/src/utils/with-nx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 = [
Expand Down

0 comments on commit 51bb80d

Please sign in to comment.