通过@import引入的.div{display: flex;}没有前缀,如果直接写在css活less文件中 就会带着前缀,这是为什么?
可能是因为你的是webpack2.0,通过@import引入的话要下载个postcss-import插件,在命令行工具输入npm install postcss-import --save-dev 然后再在代码中获取这个插件
{
test:/\.css$/,
use:[
'style-loader',
{loader:'css-loader',options:{importLoaders:1}},
{
loader:'postcss-loader',
options:{
plugins:function(){
return [
require('postcss-import')(), //一定要写在require("autoprefixer")前面,否则require("autoprefixer")无效
require("autoprefixer")({browsers:['last 5 versions']})
]
}
}
}
]
},我写了还是没有用