mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-05-01 17:29:53 -05:00
f5135d41a5
As long as the `minimize` option is set to false (which is default in production mode), the code won't be minimized. So the mode doesn't matter when it comes to the `minimizer` config. By exposing this config, users can simplify their custom config, by removing the `process.env.NODE_ENV === 'production'` guard around their custom minimizer configuration.
22 lines
645 B
JavaScript
22 lines
645 B
JavaScript
module.exports = (api, options) => {
|
|
api.chainWebpack(webpackConfig => {
|
|
if (process.env.NODE_ENV === 'production') {
|
|
webpackConfig
|
|
.mode('production')
|
|
.devtool(options.productionSourceMap ? 'source-map' : false)
|
|
|
|
// keep module.id stable when vendor modules does not change
|
|
webpackConfig
|
|
.plugin('hash-module-ids')
|
|
.use(require('webpack/lib/HashedModuleIdsPlugin'), [{
|
|
hashDigest: 'hex'
|
|
}])
|
|
|
|
// disable optimization during tests to speed things up
|
|
if (process.env.VUE_CLI_TEST) {
|
|
webpackConfig.optimization.minimize(false)
|
|
}
|
|
}
|
|
})
|
|
}
|