Transpile also dependencies in node_modules

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) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2019-05-23 17:03:04 +02:00 committed by Daniel Calviño Sánchez
parent fd90af50d9
commit 515171a653
3 changed files with 5 additions and 2 deletions

View File

@ -22,7 +22,6 @@
$expectedFiles = [ $expectedFiles = [
'.', '.',
'..', '..',
'.babelrc.js',
'.codecov.yml', '.codecov.yml',
'.drone.yml', '.drone.yml',
'.eslintrc.js', '.eslintrc.js',
@ -46,6 +45,7 @@ $expectedFiles = [
'autotest-external.sh', 'autotest-external.sh',
'autotest-js.sh', 'autotest-js.sh',
'autotest.sh', 'autotest.sh',
'babel.config.js',
'build', 'build',
'CHANGELOG.md', 'CHANGELOG.md',
'CODE_OF_CONDUCT.md', 'CODE_OF_CONDUCT.md',

View File

@ -81,7 +81,10 @@ module.exports = []
{ {
test: /\.js$/, test: /\.js$/,
loader: 'babel-loader', 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)$/, test: /\.(png|jpg|gif)$/,