webpack+jquery+bootStrap构建多页面应用(一)

转载https://www.tensweets.com/article/5cbdf91a362e5434baf63379;

遇到的问题及解决方案:

1.运行npm run dev时报错 Cannot find module 'webpack-cli/bin/config-yargs'

原因:webpack webpack-cli webpack-dev-server版本兼容问题,改为以下版本错误消失:

"webpack": "^5.24.0",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.2"

2.再次运行npm run dev时报错TypeError: CleanWebpackPlugin is not a constructor

错误代码:

const CleanWebpackPlugin = require('clean-webpack-plugin');

改为正确代码:

const { CleanWebpackPlugin } = require('clean-webpack-plugin');

 

posted @ 2021-02-24 11:29  青春给了义务教育  阅读(329)  评论(0编辑  收藏  举报