webpack打包配置中出现的问题

第一个错误:

One CLI for webpack must be installed. These are recommended choices, delivered as separate packages:

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" }
]
}
};

 


posted @ 2018-08-02 15:28  归尘2016  阅读(1105)  评论(2编辑  收藏  举报