]> source.dussan.org Git - nextcloud-server.git/commitdiff
Transpile also dependencies in node_modules
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Thu, 23 May 2019 15:03:04 +0000 (17:03 +0200)
committerDaniel Calviño Sánchez <danxuliu@gmail.com>
Tue, 29 Oct 2019 11:56:00 +0000 (12:56 +0100)
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>
.babelrc.js [deleted file]
babel.config.js [new file with mode: 0644]
build/files-checker.php
webpack.common.js

diff --git a/.babelrc.js b/.babelrc.js
deleted file mode 100644 (file)
index 004c14b..0000000
+++ /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 (file)
index 0000000..004c14b
--- /dev/null
@@ -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
+                       }
+               ]
+       ]
+};
index a6a71e149eb828612c77b577699e904d8e017266..ed9ff9ac5ef23dfd11dd635517927a19504ae6bd 100644 (file)
@@ -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',
index 53c5d5e67698306a7cca54369d3a9761151a19f4..4a8cf1d2a0fb012873d6888dd62bf47c654b0bf8 100644 (file)
@@ -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)$/,