webpack3升级webpack4

cnpm i webpck@4 webpack-cli -D

cnpm i webpack-cli -D

cnpm update

npm WARN deprecated extract-text-webpack-plugin@3.0.2: Deprecated. Please use https://github.com/webpack-contrib/mini-css-extract-plugin

npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.

删除

// "extract-text-webpack-plugin": "^3.0.2",

cnpm install mini-css-extract-plugin -D //^0.8.0

升级

webpack-dev-server

"webpack-dev-server": "^3.8.2"

  • rm -rf node_modules
  • rm package-lock.json
  • npm cache clear --force
  • npm install

Error: webpack.optimize.CommonsChunkPlugin has been removed, please use config.optimization.splitChunks instead.

升级

"vue-loader": "^13.0.5", =》

"vue-loader": "^15.7.1",

vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config

const VueLoaderPlugin = require('vue-loader/lib/plugin')

plugins: [

  // make sure to include the plugin for the magic

  new VueLoaderPlugin()

],

升级

"babel-core": "^6.26.0",

"babel-loader": "^7.1.2",

"babel-plugin-import": "^1.7.0",

"babel-plugin-syntax-dynamic-import": "^6.18.0",

"babel-preset-env": "^1.6.0",

"babel-preset-stage-3": "^6.24.1",

=》

"babel-core": "^6.26.3",

"babel-loader": "^7.1.5",

"babel-plugin-import": "^1.12.2",

"babel-plugin-syntax-dynamic-import": "^6.18.0",

"babel-preset-env": "^1.7.0",

"babel-preset-stage-3": "^6.24.1",

file-loader:^2.0.0

webpack-cli:^3.1.2

webpack:^4.25.1

TypeError: CleanWebpackPlugin is not a constructor

Time: 9631ms