webpack.config.js代码:
var webpack = require('webpack');
var path = require("path");
module.exports = {
entry: './src/app.js',
output: {
path: path.resolve(__dirname,'./bin'),
filename: 'app.bundle.js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['es2015']
}
}
]
}
执行webpack命令的时候就报错:
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.configuration.module has an unknown property 'loaders'. These properties are valid:
我查看了webpack -v 是3.2.0
我把module下面的loaders字符换成rules又不会报错了。
我上网查了下,好像是webpack1,和webpack2的配置不同,
不知道我电脑是不是装了webpack1和webpack2,我查看过其它项目都是用的rulse,没有loaders,是不是webpack1不怎么用了,还是怎么的?
webpack v2 之后都用rules 了