From 5a1ccec61f256a0b75fb9bd30b9322409cf07199 Mon Sep 17 00:00:00 2001 From: "Xin Du (Clark)" Date: Sat, 31 Jul 2021 21:26:32 +0100 Subject: [PATCH] fix(webpack): enable minimize for client production bundles (#404) --- packages/kit/src/config/schema/build.ts | 2 +- packages/webpack/src/configs/client.ts | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/packages/kit/src/config/schema/build.ts b/packages/kit/src/config/schema/build.ts index 11d3f6b276..693120d7cd 100644 --- a/packages/kit/src/config/schema/build.ts +++ b/packages/kit/src/config/schema/build.ts @@ -291,7 +291,7 @@ export default { optimization: { runtimeChunk: 'single', /** Set minimize to false to disable all minimizers. (It is disabled in development by default) */ - minimize: { $resolve: (val, get) => val ?? get('dev') }, + minimize: { $resolve: (val, get) => val ?? !get('dev') }, /** You can set minimizer to a customized array of plugins. */ minimizer: undefined, splitChunks: { diff --git a/packages/webpack/src/configs/client.ts b/packages/webpack/src/configs/client.ts index fb65be6cd3..95f45b1261 100644 --- a/packages/webpack/src/configs/client.ts +++ b/packages/webpack/src/configs/client.ts @@ -71,14 +71,7 @@ function clientHMR (ctx: WebpackConfigContext) { config.plugins.push(new webpack.HotModuleReplacementPlugin()) } -function clientOptimization (ctx: WebpackConfigContext) { - const { options, config } = ctx - - config.optimization = { - ...config.optimization, - ...options.build.optimization as any - } - +function clientOptimization (_ctx: WebpackConfigContext) { // TODO: Improve optimization.splitChunks.cacheGroups }