Skip to content

Commit

Permalink
Merge pull request #12887 from Snuffleupagus/keep-logical-assignment-…
Browse files Browse the repository at this point in the history
…operators

Keep logical assignment operators in `MOZCENTRAL`/`TESTING`-builds
  • Loading branch information
timvandermeij authored Jan 22, 2021
2 parents 5b675c7 + 4215534 commit 25d84e4
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,23 @@ function createWebpackConfig(
}
const babelExcludeRegExp = new RegExp(`(${babelExcludes.join("|")})`);

// Since logical assignment operators is a fairly new ECMAScript feature,
// for now we translate these regardless of the `SKIP_BABEL` value (with the
// exception of `MOZCENTRAL`/`TESTING`-builds where this isn't an issue).
const babelPlugins = [
"@babel/plugin-transform-modules-commonjs",
[
"@babel/plugin-transform-runtime",
{
helpers: false,
regenerator: true,
},
],
];
if (!bundleDefines.MOZCENTRAL && !bundleDefines.TESTING) {
babelPlugins.push("@babel/plugin-proposal-logical-assignment-operators");
}

const plugins = [];
if (!disableLicenseHeader) {
plugins.push(
Expand Down Expand Up @@ -241,17 +258,7 @@ function createWebpackConfig(
exclude: babelExcludeRegExp,
options: {
presets: skipBabel ? undefined : ["@babel/preset-env"],
plugins: [
"@babel/plugin-proposal-logical-assignment-operators",
"@babel/plugin-transform-modules-commonjs",
[
"@babel/plugin-transform-runtime",
{
helpers: false,
regenerator: true,
},
],
],
plugins: babelPlugins,
},
},
{
Expand Down

0 comments on commit 25d84e4

Please sign in to comment.