webpack使用autoprefixer給css3樣式新增瀏覽器字首
阿新 • • 發佈:2021-01-22
1、新增postcss-loader,注意要放到css-loader後,sass-loader之前,不然的話使用@import方式引入會無效
{
test: /\.(s[ac]ss)$/,
use: [
"style-loader",
'css-loader',
"postcss-loader",
"sass-loader"
]
}
2、專案根目錄新增postcss.config.js
module. exports = {
plugins: [
require("autoprefixer")
]
};
3、package.json中新增
"browserslist": [
"defaults",
"not ie <= 8",
"last 2 versions",
"> 1%",
"iOS >= 7",
"Android >= 4.0"
]