From 515171a653d92c292070ef047c91fd724e0de45b Mon Sep 17 00:00:00 2001 From: "John Molakvoæ (skjnldsv)" Date: Thu, 23 May 2019 17:03:04 +0200 Subject: Transpile also dependencies in node_modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some of the dependencies in node_modules, such as "p-queue", are not ES5 compatible, so they need to be transpiled to work in older browsers like Internet Explorer 11. Besides not excluding the dependencies for babel-loader in "webpack.common.js" the global Babel configuration must be defined in "babel.config.js", as in Babel 7.X, when ".babelrc.js" is used, all the dependencies in "node_modules" are ignored (even if whitelisted in the configuration file itself). Signed-off-by: John Molakvoæ (skjnldsv) --- .babelrc.js | 14 -------------- babel.config.js | 14 ++++++++++++++ build/files-checker.php | 2 +- webpack.common.js | 5 ++++- 4 files changed, 19 insertions(+), 16 deletions(-) delete mode 100644 .babelrc.js create mode 100644 babel.config.js diff --git a/.babelrc.js b/.babelrc.js deleted file mode 100644 index 004c14b5119..00000000000 --- a/.babelrc.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - plugins: [ - '@babel/plugin-syntax-dynamic-import', - ['@babel/plugin-proposal-class-properties', { loose: true }] - ], - presets: [ - [ - '@babel/preset-env', - { - modules: false - } - ] - ] -}; diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 00000000000..004c14b5119 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,14 @@ +module.exports = { + plugins: [ + '@babel/plugin-syntax-dynamic-import', + ['@babel/plugin-proposal-class-properties', { loose: true }] + ], + presets: [ + [ + '@babel/preset-env', + { + modules: false + } + ] + ] +}; diff --git a/build/files-checker.php b/build/files-checker.php index a6a71e149eb..ed9ff9ac5ef 100644 --- a/build/files-checker.php +++ b/build/files-checker.php @@ -22,7 +22,6 @@ $expectedFiles = [ '.', '..', - '.babelrc.js', '.codecov.yml', '.drone.yml', '.eslintrc.js', @@ -46,6 +45,7 @@ $expectedFiles = [ 'autotest-external.sh', 'autotest-js.sh', 'autotest.sh', + 'babel.config.js', 'build', 'CHANGELOG.md', 'CODE_OF_CONDUCT.md', diff --git a/webpack.common.js b/webpack.common.js index 53c5d5e6769..4a8cf1d2a0f 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -81,7 +81,10 @@ module.exports = [] { test: /\.js$/, loader: 'babel-loader', - exclude: /node_modules/ + // automatically detect necessary packages to + // transpile in the node_modules folder + exclude: /node_modules(?!(\/|\\)(p-finally|p-limit|p-locate|p-queue|p-timeout|p-try)(\/|\\))/ + }, { test: /\.(png|jpg|gif)$/, -- cgit v1.2.3