Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

fix(index): stricter check for shouldExtract !== wasExtracted #605

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down