webpack5.X 兼容性
编写DEMO,安装webpack后抛出异常
初始化
cnpm init -y
安装webpack及cli
cnpm i webpack webpack-cli webpack-dev-server -Dpa'c
package.json 配置启动指令
"scripts": { "dev": "webpack-dev-server" }
抛出异常:Cannot find module 'webpack-cli/bin/config-yargs'
解决:安装 @webpack-cli/serve 并修改 package.json
cnpm install -D @webpack-cli/serve
"scripts": { "dev": "webpack serve --open Chrome.exe" },