0
我正在从webpack v1迁移到v2。我跟着官方文档更新webpack.config.js
:在Webpack 2中使用extractTextPlugin和postCss插件
...
module: {
rules: [
{
test: /\.css$/,
use: extractTextPlugin.extract({
fallback: 'style-loader',
use: [
'css-loader?modules&localIdentName=[path][name]_[local]--[hash:base64:8]',
'postcss-loader'
],
}),
exclude: [...]
},
{
test: /\.css$/,
use: extractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader',
}),
include: [...]
}
]
},
...
/**
* postcss: [
* nested(),
* autoprefixer(),
* values
* ]
*/
我的问题是postcss插件(嵌套,autoprefixer,值)。 Webpack 2不再支持自定义属性,并建议使用options
。
我尝试了options
和plugins:() => [nested, autoprefixer, values]
,但无法使其工作。
这样做的正确方法是什么?谢谢。