升级webpack4错误处理

1.升级到4.0之后未能正常使用

处理:npm i webpack webpack-cli webpack-dev-server webpack-merge -D

2. Error: Plugin could not be registered at 'html-webpack-plugin-before-html-processing'. Hook was not found.

处理:由于html-webpack-plugin和webpack4.0未匹配,升级html-webpack-plugin插件

3. TypeError: Cannot read property 'vue' of undefine

处理:由于vue-loader和webpack4.0未匹配,需要升级vue-loader, npm i vue-loader -D,

并且修改配置build/webpack.base.conf.js,加入

plugins: [
    new VueLoaderPlugin()
],

资源搜索网站大全https://55wd.com 广州品牌设计公司http://www.maiqicn.com

4. Uncaught TypeError: Cannot assign to read only property 'exports' of object ‘#

解决:修改配置build/webpack.base.conf.js

把这段注释//include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]

加入这段:include: [resolve('src'), resolve('test')]