DEV: Add DISCOURSE_WEBPACK_MINIMIZE to reenable webpack minimize. (#28066)

Disabling webpack minimize is a bug we are working to resolve but we
have to consider self-hosters that deploy on low cost hardware
and reenabling this for them drastically increases the build time.
For now, add a  `DISCOURSE_WEBPACK_MINIMIZE` env to allow sites to opt
back in.
This commit is contained in:
Alan Guo Xiang Tan 2024-07-25 06:55:29 +08:00 committed by GitHub
parent 7a7cc815be
commit c7911441fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -140,8 +140,8 @@ module.exports = function (defaults) {
chunkFilename: `assets/chunk.[chunkhash].${cachebusterHash}.js`,
},
optimization: {
// Disable webpack minimization. Embroider automatically applies terser after webpack.
minimize: false,
// TODO: Minimization being disabled is a bug and we are currently working to restore it.
minimize: process.env.DISCOURSE_WEBPACK_MINIMIZE === "1",
},
cache: isProduction
? false