我一直在尝试使用 LESS 和 Autoprefixer 配置 webpack,但 autoprefixer 似乎不起作用。我的 css 或更少的文件没有自动添加前缀。示例:
display: flex
停留display: flex
我把我的 webpack 配置放在下面:
var autoprefixer = require('autoprefixer');
module.exports = {
entry: {
bundle: "./index.jsx"
},
output: {
path: __dirname,
filename: "[name].js"
},
module: {
loaders: [
{
test: /\.jsx$/,
exclude: /(node_modules|bower_components)/,
loaders: ['react-hot', 'babel-loader']
},
{
test: /\.less$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader!postcss-loader!less-loader")
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader!postcss-loader")
}
],
postcss: function () {
return [autoprefixer];
}
},
plugins: [
new webpack.BannerPlugin(banner),
new ExtractTextPlugin("style.css")
],
devtool: 'source-map',
devServer: {
stats: 'warnings-only',
}
};