Skip to content

Commit 1200397

Browse files
fix: handle functions as loaders
Do not break when searching through `use` or `loader` that is a function
1 parent 4eac0f6 commit 1200397

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "extract-css-chunks-webpack-plugin",
3-
"version": "3.2.0",
3+
"version": "3.2.1-alpha.0",
44
"author": "James Gillmore <james@faceyspacey.com>",
55
"contributors": [
66
"Zack Jackson <zack@ScriptedAlchemy.com> (https://github.com/ScriptedAlchemy)"

src/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,9 @@ class ExtractCssChunks {
427427
if (node && node.use && Array.isArray(node.use)) {
428428
const isMiniCss = node.use.some((l) => {
429429
const needle = l.loader || l;
430+
if (typeof l === 'function') {
431+
return false;
432+
}
430433
return needle.includes(pluginName);
431434
});
432435
if (isMiniCss) {
@@ -436,6 +439,9 @@ class ExtractCssChunks {
436439
if (node && node.loader && Array.isArray(node.loader)) {
437440
const isMiniCss = node.loader.some((l) => {
438441
const needle = l.loader || l;
442+
if (typeof l === 'function') {
443+
return false;
444+
}
439445
return needle.includes(pluginName);
440446
});
441447
if (isMiniCss) {

0 commit comments

Comments
 (0)