From afe1817f5178bab57c052bc5875b71e77be86850 Mon Sep 17 00:00:00 2001 From: Konstantin Lopyrev Date: Thu, 5 Apr 2018 12:41:35 +0300 Subject: [PATCH] Duck typing instead of instanceof --- index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 713a8ed6..bb4bdf39 100644 --- a/index.js +++ b/index.js @@ -355,7 +355,14 @@ function getPath(compilation, source, chunk) { } function isChunk(chunk, error) { - if (!(chunk instanceof Chunk)) { + if ( + !chunk || + ( + !chunk.modulesIterable && + !chunk.forEachModule && + !chunk.modules + ) + ) { throw new Error(typeof error === 'string' ? error : 'chunk is not an instance of Chunk'); }