Skip to content

Commit

Permalink
fix(bundling): update the browsers for es5 terser check (#17784)
Browse files Browse the repository at this point in the history
(cherry picked from commit 8c9ad0d)
  • Loading branch information
Coly010 authored and FrozenPandaz committed Jul 7, 2023
1 parent 0d04949 commit ea28f16
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 ea28f16

Please sign in to comment.