第一个错误:
One CLI for webpack must be installed. These are recommended choices, delivered as separate packages:
- webpack-cli (https://github.com/webpack/we...
The original webpack full-featured CLI. - webpack-command (https://github.com/webpack-co...
A lightweight, opinionated webpack CLI.
We will use "npm" to install the CLI via "npm install -D".
Which one do you like to install (webpack-cli/webpack-command):
解决方法:npm install webpack-cli -g (升级为wekpack需要再安装webpack-cli)
第二个人错误:
解决方法:出现这个错误提示并不是我们环境装错了,而是webpack4 更新后对webpack语法进行了更严格的要求
之前的命令被修订为 npm webpack a.js --output-filename bundle.js --output-path . --mode development
第三个错误:
解决方法:webpack.config.js里面module里面的loaders改成rules
module.exports = {
entry: "./runoob1.js",
output: {
path: __dirname,
filename: "bundle.js"
},
module: {
rules: [//原来是loaders
{ test: /\.css$/, loader: "style-loader!css-loader" }
]
}
};