Npm start error after installing npm I webpack-parallel-uglify-plugin

background:
the packing speed of the project is now very slow. Check the Internet about the method of optimizing the packing speed. It is said that the packing speed is obviously fast by using webpack-parallel-uglify-plugin instead of webpack.optimize.UglifyJsPlugin . After installing webpack-parallel-uglify-plugin , re-npm start, only does these two operations, first

.
npm i webpack-parallel-uglify-plugin

then did not change any code

npm start

found that an error was reported in the console

Mar.30,2021

my webpack.prod.conf.js configuration

plugins: [
...
new ParallelUglifyPlugin({
  cacheDir: '.cache/',
  uglifyJS: {
    output: {
      comments: false
    },
    compress: {
      warnings: false
    }
  },
  sourceMap: config.build.productionSourceMap
}),
...
]

No problem with packing


There is a problem with the version of

webpack-parallel-uglify-plugin. The old version certainly does not support es6 syntax, so it is written as follows

.
new ParallelUglifyPlugin({ 
  uglifyJS: {
  }
})

the new version should be written like this, turning uglifyJS into uglifyES

new ParallelUglifyPlugin({ 
  uglifyES: {
  }
})
Menu