about summary refs log tree commit diff
path: root/config/webpack/rules/node_modules.js
diff options
context:
space:
mode:
Diffstat (limited to 'config/webpack/rules/node_modules.js')
-rw-r--r--config/webpack/rules/node_modules.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/config/webpack/rules/node_modules.js b/config/webpack/rules/node_modules.js
new file mode 100644
index 000000000..5debc1b5d
--- /dev/null
+++ b/config/webpack/rules/node_modules.js
@@ -0,0 +1,32 @@
+const { join } = require('path');
+const { settings, env } = require('../configuration');
+
+module.exports = {
+  test: /\.(js|mjs)$/,
+  include: /node_modules/,
+  exclude: /@babel(?:\/|\\{1,2})runtime/,
+  use: [
+    {
+      loader: 'babel-loader',
+      options: {
+        babelrc: false,
+        plugins: [
+          [
+            'transform-react-remove-prop-types',
+            {
+              mode: 'remove',
+              removeImport: true,
+              additionalLibraries: [
+                '../../utils/shared-props', // emoji-mart
+              ],
+            },
+          ],
+        ],
+        cacheDirectory: join(settings.cache_path, 'babel-loader-node-modules'),
+        cacheCompression: env.NODE_ENV === 'production',
+        compact: false,
+        sourceMaps: false,
+      },
+    },
+  ],
+};