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`)
This commit is contained in:
Emma Segal-Grossman 2023-12-12 14:37:50 -05:00 committed by GitHub
parent 7e4650ed61
commit a5dd35bd6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)()]
: []),
],
};