Skip to content

Commit

Permalink
Use the @babel/preset-env to selecte working list of browser
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Sep 14, 2023
1 parent 35c3b1b commit 7d4bb55
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
10 changes: 7 additions & 3 deletions buildtools/webpack.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ module.exports = (env, argv) => {
options: {
babelrc: false,
comments: false,
plugins: [
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
require.resolve('@babel/plugin-proposal-optional-chaining'),
presets: [
'@babel/preset-env',
{
targets: require('./webpack.share').browsers,
modules: false,
loose: true,
},
],
},
},
Expand Down
24 changes: 12 additions & 12 deletions buildtools/webpack.commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ module.exports = function (config) {
$: 'jquery',
});

const babelPresetEnv = [
require.resolve('@babel/preset-env'),
{
targets: config.browsers || require('./webpack.share').browsers,
loose: true,
},
];

// Expose corejs-typeahead as window.Bloodhound
const typeaheadRule = {
test: require.resolve('corejs-typeahead'),
Expand Down Expand Up @@ -144,16 +152,14 @@ module.exports = function (config) {
assumptions: {
setPublicClassFields: true,
},
presets: [babelPresetEnv],
plugins: [
[
require.resolve('@babel/plugin-transform-typescript'),
// TODO remove allowDeclareFields with Babel 8
{allowDeclareFields: true},
],
[require.resolve('@babel/plugin-proposal-decorators'), {decoratorsBeforeExport: true}],
require.resolve('@babel/plugin-proposal-class-properties'),
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
require.resolve('@babel/plugin-proposal-optional-chaining'),
],
},
},
Expand All @@ -173,11 +179,8 @@ module.exports = function (config) {
options: {
babelrc: false,
comments: false,
plugins: [
require.resolve('babel-plugin-angularjs-annotate'),
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
require.resolve('@babel/plugin-proposal-optional-chaining'),
],
presets: [babelPresetEnv],
plugins: [require.resolve('babel-plugin-angularjs-annotate')],
},
},
};
Expand All @@ -200,10 +203,7 @@ module.exports = function (config) {
options: {
babelrc: false,
comments: false,
plugins: [
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
require.resolve('@babel/plugin-proposal-optional-chaining'),
],
presets: [babelPresetEnv],
},
},
};
Expand Down
12 changes: 9 additions & 3 deletions buildtools/webpack.config.dll.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,15 @@ module.exports = {
options: {
babelrc: false,
comments: false,
plugins: [
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
require.resolve('@babel/plugin-proposal-optional-chaining'),
presets: [
[
require.resolve('@babel/preset-env'),
{
targets: require('./webpack.share').browsers,
modules: false,
loose: true,
},
],
],
},
},
Expand Down

0 comments on commit 7d4bb55

Please sign in to comment.