我正在使用postcss,autoprefixer和extract-text-webpack-plugin与Webpack 3,但在编译时我缺少前缀。编译后的css只包含-webkit前缀,而不包含-ms和-moz前缀。
我不确定我做错了什么。
我的配置:
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader'
},
{
test: /\.s[ac]ss$/,
loader: ExtractText.extract({
use: [
{
loader: 'css-loader',
options: {
sourceMap: true
}
},
{
loader: 'postcss-loader',
options: {
ident: 'postcss',
sourceMap: true,
plugins: () => [autoprefixer()]
}
},
{
loader: 'sass-loader',
options: {
sourceMap: true
}
}
],
fallback: 'style-loader',
})
},
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
use: 'file?=name/fonts/[name].[ext]'
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
use: [{
loader: 'file-loader',
options: {
name: '[name]-[hash:8].[ext]',
pluginPath: BUILD_DIR + '/images/',
outputPath: BUILD_DIR + '/images/'
}
}]
}]
},
我在package.json中的浏览器列表包含:
"browserslist": [
"defaults",
"not ie < 9",
"last 2 versions"
],