npm install --save-dev postcss-loader
{ test:/\.css$/, use:[ 'style-loader', 'css-loader?importLoaders=1', 'postcss-loader' ] }
一種辦法是配置postcss.config.js
css
module.exports = { plugins: [ require('autoprefixer')({ /* ...options */ }) ] }
第二張辦法是webpack.config.js使用LoaderOptionsPlugin
webpack
module.exports = { plugins: [ new webpack.LoaderOptionsPlugin({ options: { postcss: function(){ return [ require("autoprefixer")({ browsers: ['ie>=8','>1% in CN'] }) ] } } }) ] }