test: /\.css$/,
exclude: /node_modules/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: { importLoaders: 1 }
},
'postcss-loader'
]
})
...
new ExtractTextPlugin('../css/[name].bundle.css')
postcss.config.js
module.export = {
plugins: [
require('autoprefixer')
]
}
的package.json
"webpack": "^3.10.0",
"css-loader": "^0.28.9",
"style-loader": "^0.20.1",
"extract-text-webpack-plugin": "^3.0.2",
"postcss-loader": "^2.0.10",
"autoprefixer": "^7.2.5",
其他信息
$ node -v
v9.4.0
运行此配置时,我没有错误。它运行就好像postcss-loader不存在并给我简单的CSS。我正在尝试运行autoprefixer site
上发布的基本示例答案 0 :(得分:0)
test: /\.css$/,
exclude: /node_modules/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
'css-loader',
{
loader: 'postcss-loader',
options: {
plugins: () => [
require('autoprefixer')
]
}
}
]
})
...
new ExtractTextPlugin('/css/[name].bundle.css')