安装postcss-loader
npm install --save-dev postcss-loader
配置webpack.config.js
{
test:/\.css$/,
use:[
‘style-loader‘,
‘css-loader?importLoaders=1‘,
‘postcss-loader‘
]
}
一种办法是配置postcss.config.js
module.exports = {
plugins: [
require(‘autoprefixer‘)({
/* ...options */
})
]
}
第二张办法是webpack.config.js使用LoaderOptionsPlugin
module.exports = {
plugins: [
new webpack.LoaderOptionsPlugin({
options: {
postcss: function(){
return [
require("autoprefixer")({
browsers: [‘ie>=8‘,‘>1% in CN‘]
})
]
}
}
})
]
}
原文地址:https://www.cnblogs.com/qiqi715/p/9339204.html
时间: 2024-10-05 05:04:46