prod.js 645 B

123456789101112131415161718192021
  1. module.exports = (api, options) => {
  2. api.chainWebpack(webpackConfig => {
  3. if (process.env.NODE_ENV === 'production') {
  4. webpackConfig
  5. .mode('production')
  6. .devtool(options.productionSourceMap ? 'source-map' : false)
  7. // keep module.id stable when vendor modules does not change
  8. webpackConfig
  9. .plugin('hash-module-ids')
  10. .use(require('webpack/lib/HashedModuleIdsPlugin'), [{
  11. hashDigest: 'hex'
  12. }])
  13. // disable optimization during tests to speed things up
  14. if (process.env.VUE_CLI_TEST) {
  15. webpackConfig.optimization.minimize(false)
  16. }
  17. }
  18. })
  19. }