vue-ssr-tech
vue-ssr-tech copied to clipboard
webpack3升级webpack4的步骤和注意的点
1、先卸载重新安装webpack
npm uninstall webpack webpack-dev-server webpack-merge -D
npm install webpack webpack-dev-server webpack-merge -D
2、相关的npm包也需要更新
npm uninstall babel-loader eslint-loader extract-text-webpack-plugin file-loader html-webpack-plugin url-loader -D
npm install babel-loader eslint-loader extract-text-webpack-plugin file-loader html-webpack-plugin url-loader -D
3、有的包更新依旧没有适配webpack4会出现WARN
npm WARN [email protected] requires a peer of webpack@^3.1.0 but none is installed. You must install peer dependencies yourself.
4、针对没有适配的包就hack一下,用他们未发布的版本
npm install extract-text-webpack-plugin@next -D
5、修改webpack.config.base.js和webpack.config.client.js 会有mode和optimization的增加,废弃掉了CommonsChunkPlugin,具体可以看看慕课网上Jocky老师的webpack4升级指北手记。