Skip to content

Commit f5135d4

Browse files
authored
feat: make the minimizer config available in all modes (vuejs#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.
1 parent 3b016e7 commit f5135d4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

packages/@vue/cli-service/lib/config/base.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,5 +187,11 @@ module.exports = (api, options) => {
187187
additionalTransformers: [transformer],
188188
additionalFormatters: [formatter]
189189
}])
190+
191+
const TerserPlugin = require('terser-webpack-plugin')
192+
const terserOptions = require('./terserOptions')
193+
webpackConfig.optimization
194+
.minimizer('terser')
195+
.use(TerserPlugin, [terserOptions(options)])
190196
})
191197
}

packages/@vue/cli-service/lib/config/prod.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ module.exports = (api, options) => {
1515
// disable optimization during tests to speed things up
1616
if (process.env.VUE_CLI_TEST) {
1717
webpackConfig.optimization.minimize(false)
18-
} else {
19-
const TerserPlugin = require('terser-webpack-plugin')
20-
const terserOptions = require('./terserOptions')
21-
webpackConfig.optimization
22-
.minimizer('terser')
23-
.use(TerserPlugin, [terserOptions(options)])
2418
}
2519
}
2620
})

0 commit comments

Comments
 (0)