码上敲享录 > vue.js常见问题详解 > Error: webpack.optimize.CommonsChunkPlugin has been removed, please use config.optimization.splitChu

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

上一章章节目录下一章 2019-11-27已有1441人阅读 评论(0)

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


解决方法:

我使用淘宝镜像cnpm install安装依赖成功后执行npm run build时报错:

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

我发现在cnpm install 时有警告:requires a peer of webpack@^3.1.0 but webpack@4.41.2 was installed,可以看出webpack版本有問題,就是我項目要求使用webpack@^3.1.0但下载的是webpack@4.41.2

所以我先把所有依赖删除:

rm -rf node_modules

rm -rf package-lock.json

npm cache clear --force

cpm cache clear --force

先执行cnpm install webpack@^3.1.0安装webpack,再执行cnpm install,之后再运行npm run build不报错了


向大家推荐《Activiti工作流实战教程》:https://xiaozhuanlan.com/activiti
0

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交