我有一种情况,我希望所有的手写笔文件都能使用webpack加载器......
{
test: /\.styl$/,
loaders: ["to-string", "css", "stylus"]
},
但是对于全局样式文件(以.global.styl
结尾的文件),我想使用一组不同的加载器......
loaders: ["style", "css", "stylus"]
我尝试了以下内容......
{
test: /.*(?<!global)\.styl$/,
loaders: ["to-string", "css", "stylus"]
},
但它没有用......
SyntaxError: Invalid regular expression: /.*(?<!global)\.styl$/: Invalid group
答案 0 :(得分:1)
您可以尝试不使用 ^ ,如下所示:
// First case: someFiles.styl ending with .style
{
test: /.*[^\.global]\.styl$/,
loaders: ["to-string", "css", "stylus"]
},
// Second case: someFiles.global.styl ending with .global.styl
{
test: /.*[\.global]\.styl$/,
loaders: ["different", "loaders", "stylus"]
},