是因为在package.json中添加了注释
正确webpack配置CSS兼容性的步骤:
npm i postcss-loader postcss-preset-env -D
/webpack.config.js
module: {
rules: [{
test: /\.css$/,
use: ['style-loader', 'css-loader', 'postcss-loader'],
}]
},
新建postcss.config.js
module.exports ={
plugins: [
['postcss-preset-env', {}]
]
}
/package.json
"browserslist":[
"> 1%",
"last 2 versions"
]