mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-25 16:48:56 -06:00
feat: make the minimizer config available in all modes (#4641)
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.
This commit is contained in:
@@ -187,5 +187,11 @@ module.exports = (api, options) => {
|
||||
additionalTransformers: [transformer],
|
||||
additionalFormatters: [formatter]
|
||||
}])
|
||||
|
||||
const TerserPlugin = require('terser-webpack-plugin')
|
||||
const terserOptions = require('./terserOptions')
|
||||
webpackConfig.optimization
|
||||
.minimizer('terser')
|
||||
.use(TerserPlugin, [terserOptions(options)])
|
||||
})
|
||||
}
|
||||
|
||||
@@ -15,12 +15,6 @@ module.exports = (api, options) => {
|
||||
// disable optimization during tests to speed things up
|
||||
if (process.env.VUE_CLI_TEST) {
|
||||
webpackConfig.optimization.minimize(false)
|
||||
} else {
|
||||
const TerserPlugin = require('terser-webpack-plugin')
|
||||
const terserOptions = require('./terserOptions')
|
||||
webpackConfig.optimization
|
||||
.minimizer('terser')
|
||||
.use(TerserPlugin, [terserOptions(options)])
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user