From 510704ffc44d6bec5e97b5aeef160542abf30f12 Mon Sep 17 00:00:00 2001 From: Kostas Manionis Date: Thu, 14 Sep 2017 01:53:02 +0300 Subject: [PATCH] fix(index): stricter check for `shouldExtract !== wasExtracted` (#605) --- src/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index f97c349f..69787f4b 100644 --- a/src/index.js +++ b/src/index.js @@ -149,7 +149,10 @@ class ExtractTextPlugin { let meta = module[NS]; if (meta && (!meta.options.id || meta.options.id === id)) { const wasExtracted = Array.isArray(meta.content); - if (shouldExtract !== wasExtracted) { + // A stricter `shouldExtract !== wasExtracted` check to guard against cases where a previously extracted + // module would be extracted twice. Happens when a module is a dependency of an initial and a non-initial + // chunk. See issue #604 + if (shouldExtract && !wasExtracted) { module[`${NS}/extract`] = shouldExtract; // eslint-disable-line no-path-concat compilation.rebuildModule(module, (err) => { if (err) {