错误提示如下:
For loader options: webpack 2 no longer allows custom properties in configuration. Loaders should be updated to allow passing options via loader options in module.rules. Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader: plugins: [ new webpack.LoaderOptionsPlugin({ // test: /\.xxx$/, // may apply this only for some modules options: { postcss: ... } }) ]
也就是说,Webpack 2.1.0-beta23之后的版本,不能直接包含自定义配置项,如下:
postcss: [ require('autoprefixer') ],
必须要使用下面这样的方式
plugins: [ new webpack.LoaderOptionsPlugin({ options: { postcss: [ require('autoprefixer')//调用autoprefixer插件 ] } }) ]