我有一个相当复杂的样式表加载器设置:
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract("style",
"css?sourceMap&localIdentName=[path][name]__[local]__[hash:base64:5]!sass?outputStyle=expanded&" +
"includePaths[]=" + other stuff)
)
}
这很好用,但在某些情况下,我想要在css-loader中添加modules
选项,看起来像这样:
require('./foo.scss!css?modules&sourceMap&localIdentName=[path][name]__[local]__[hash...');
但我不能在所有地方都这样做。
如何配置使我能够在保持其余部分不变的情况下,在某些需要中启用css-loader模块标志?
也许像一个加载器“别名”,例如 require('./foo.scss!my-scss-with-modules-flag-alias')
?
我能想到的唯一解决方案是编写一个加载器,对某些要求调用进行语法转换以将加载器配置嵌入其中...但这很脆弱和复杂。