Skip to content

Commit c847041

Browse files
committed
Support loaders specified as an array
Current if the loaders are specified as an array, then extract will assume they are the options. If the `notExtractLoader` is specified as an array then there will be an error when trying to split it. It might be best to only support this change if `loaders:` is used instead of `loader:` but even solving that problem at all seems to be a larger issue. This at least allows for using an array of loaders even if it still must be in a `loader:` context.
1 parent a03c82c commit c847041

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,19 @@ ExtractTextPlugin.loader = function(options) {
127127
};
128128

129129
ExtractTextPlugin.extract = function(before, loader, options) {
130-
if(typeof loader === "string") {
130+
if(typeof loader === "string" || Array.isArray(loader)) {
131+
if(typeof before === "string") {
132+
before = before.split("!")
133+
}
131134
return [
132-
ExtractTextPlugin.loader(mergeOptions({omit: before.split("!").length, extract: true, remove: true}, options)),
133-
before,
134-
loader
135-
].join("!");
135+
ExtractTextPlugin.loader(mergeOptions({omit: before.length, extract: true, remove: true}, options))
136+
].concat(before, loader).join("!");
136137
} else {
137138
options = loader;
138139
loader = before;
139140
return [
140141
ExtractTextPlugin.loader(mergeOptions({remove: true}, options)),
141-
loader
142-
].join("!");
142+
].concat(loader).join("!");
143143
}
144144
};
145145

0 commit comments

Comments
 (0)