解决webpack4.x使用autoprefixer 无效
安装
npm i webpck webpack-cli style-loader postcss-loader -D
配置
webpack.config.js
module: {
rules: [{
test: /\.css/,
use: ['style-loader', 'postcss-loader']
}]
}
postcss.config.js
module.exports = {
plugins: [
require('autoprefixer')
]
}
到这一步运行发现没有效果😷,https://github.com/browserslist/browserslist#readme, 配置一手
package.json
"browserslist": [
"defaults",
"not ie < 11",
"last 2 versions",
"> 1%",
"iOS 7",
"last 3 iOS versions"
]
success!👏