Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration has an unknown property 'postcss'. These properties are valid:
module: { rules: [ { test: /\.js$/, loader: 'babel-loader', exclude:path.resolve(__dirname,'/node_modules'), include:path.resolve(__dirname,'/src'), options: { presets: ['env'] } }, { test: /\.css$/, loader:"style-loader!css-loader!postcss-loader" } ] }, postcss:[ require('autoprefixer')({ browsers: ['last 5 versions'] }) ]
原因是版本更新。现在的新版本操作:
在webpack.config.js同级目录创建一个postcss.config.js
在postcss.config.js中输入
module.exports = {
plugins: {
'autoprefixer': {browsers: 'last 5 version'}
}
}
另外附上慕课网视频网址: