fix(webpack): enable minimize for client production bundles (#404)

This commit is contained in:
Xin Du (Clark) 2021-07-31 21:26:32 +01:00 committed by GitHub
parent 403ee671eb
commit 5a1ccec61f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 9 deletions

View File

@ -291,7 +291,7 @@ export default {
optimization: { optimization: {
runtimeChunk: 'single', runtimeChunk: 'single',
/** Set minimize to false to disable all minimizers. (It is disabled in development by default) */ /** 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. */ /** You can set minimizer to a customized array of plugins. */
minimizer: undefined, minimizer: undefined,
splitChunks: { splitChunks: {

View File

@ -71,14 +71,7 @@ function clientHMR (ctx: WebpackConfigContext) {
config.plugins.push(new webpack.HotModuleReplacementPlugin()) config.plugins.push(new webpack.HotModuleReplacementPlugin())
} }
function clientOptimization (ctx: WebpackConfigContext) { function clientOptimization (_ctx: WebpackConfigContext) {
const { options, config } = ctx
config.optimization = {
...config.optimization,
...options.build.optimization as any
}
// TODO: Improve optimization.splitChunks.cacheGroups // TODO: Improve optimization.splitChunks.cacheGroups
} }