Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

make sure we only skip transipling node_modules in dev mode

Jason Kent87b79aef6e23
diff --git a/webpack.config.js b/webpack.config.js
index 6e5340d60..821f7c893 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -6,7 +6,6 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const WriteFilePlugin = require('write-file-webpack-plugin');
const postcssPresetEnv = require('postcss-preset-env');
const postcssNesting = require('postcss-nesting');
-
// production optimizations
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const cssnano = require('cssnano');
@@ -68,10 +67,22 @@ if (process.env.TESTING_MODE === 'true') {
}
*/
+const babelLoaderExcludes = [
+ /\.test\.js$/,
+ /fixtures\.js$/,
+ /core-js/,
+];
// Inlucde any modules that need to be transpiled by babel-loader
const transpileDependencies = [
'react-visibility-sensor',
];
+if (devMode) {
+ // Don't transpile any dependencies in /node_modules except those found
+ // in transpileDependencies array
+ babelLoaderExcludes.push(
+ new RegExp(`node_modules/(?!(${transpileDependencies.join('|')})/).*`),
+ );
+}
module.exports = {
resolve: {
@@ -150,13 +161,7 @@ module.exports = {
plugins: [devMode && require.resolve('react-refresh/babel')].filter(Boolean),
},
},
- exclude: [
- /\.test\.js$/,
- /fixtures\.js$/,
- /core-js/,
- new RegExp(`node_modules/(?!(${transpileDependencies.join('|')})/).*`),
- ],
-
+ exclude: babelLoaderExcludes,
},
{
test: require.resolve('jquery'), // expose globally for jQuery plugins