diff --git a/webpack.config.prod.js b/webpack.config.prod.js index 6f1fdff9b..50123e9a3 100644 --- a/webpack.config.prod.js +++ b/webpack.config.prod.js @@ -31,6 +31,8 @@ prodConfig.module.rules = [ }, ]; +const analyzeBundles = process.env.WEBPACK_ANALYZE?.toLowerCase() === "true"; + module.exports = Object.assign(prodConfig, { context: __dirname, mode: "production", @@ -53,9 +55,13 @@ module.exports = Object.assign(prodConfig, { new MiniCssExtractPlugin({ filename: "[name]-[contenthash].css", }), - new BundleAnalyzerPlugin({ - analyzerMode: "static", - }), + ...(analyzeBundles + ? [ + new BundleAnalyzerPlugin({ + analyzerMode: "static", + }), + ] + : []), ], optimization: { minimize: true,