From c7911441faa5c082229d229773d9892bced4ae6a Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Thu, 25 Jul 2024 06:55:29 +0800 Subject: [PATCH] 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. --- app/assets/javascripts/discourse/ember-cli-build.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/ember-cli-build.js b/app/assets/javascripts/discourse/ember-cli-build.js index 180381fed28..dd8bf47bc47 100644 --- a/app/assets/javascripts/discourse/ember-cli-build.js +++ b/app/assets/javascripts/discourse/ember-cli-build.js @@ -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