From 0a518bcb68766da3fbae980c6ba988a3ceb190e2 Mon Sep 17 00:00:00 2001 From: William Chong Date: Tue, 12 Sep 2023 01:52:22 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20unoptimized=20webpack=20mo?= =?UTF-8?q?dule=20output?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webpack.config.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index e5c245f..6b5bfe3 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -64,6 +64,24 @@ module.exports = { path: BUILD_DIR, publicPath: `/${BUILD_DIR_NAME}/`, }, + optimization: { + minimize: !DEBUG, + splitChunks: { + cacheGroups: { + vendor: { + test: /[\\/]node_modules[\\/]/, + name: 'vendor', + chunks: 'all', + }, + common: { + chunks: 'all', + name: 'common', + minChunks: 2, + }, + }, + }, + runtimeChunk: false, + }, performance: { maxEntrypointSize: 1000000, maxAssetSize: 300000, @@ -157,8 +175,6 @@ module.exports = { new webpack.HotModuleReplacementPlugin(), ] : [ // Production - new webpack.HashedModuleIdsPlugin(), new webpack.DefinePlugin({ 'global.GENTLY': false }), - new webpack.optimize.ModuleConcatenationPlugin(), ]), };