From a5dd35bd6e89ea32cd3bdca4fa5c32769a4957e7 Mon Sep 17 00:00:00 2001 From: Emma Segal-Grossman Date: Tue, 12 Dec 2023 14:37:50 -0500 Subject: [PATCH] Only load webpack-bundle-analyzer if BUNDLE_ANALYZER env var is present (#1446) Fixes build failing in main Tested with a local build (`./scripts/build-frontend.sh`) --- frontend/webpack.config.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/webpack.config.js b/frontend/webpack.config.js index 582535c4..83d64a1e 100644 --- a/frontend/webpack.config.js +++ b/frontend/webpack.config.js @@ -10,7 +10,6 @@ const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin"); const childProcess = require("child_process"); const packageJSON = require("./package.json"); const fs = require("fs"); -const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); const isDevServer = process.env.WEBPACK_SERVE; @@ -175,7 +174,9 @@ const main = { }, ], }), - ...(process.env.BUNDLE_ANALYZER ? [new BundleAnalyzerPlugin()] : []), + ...(process.env.BUNDLE_ANALYZER + ? [new (require("webpack-bundle-analyzer").BundleAnalyzerPlugin)()] + : []), ], };