File tree 1 file changed +11
-2
lines changed 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ class ExtractTextPlugin {
143
143
} ) ;
144
144
async . forEach ( chunks , ( chunk , callback ) => { // eslint-disable-line no-shadow
145
145
const extractedChunk = extractedChunks [ chunks . indexOf ( chunk ) ] ;
146
- const shouldExtract = ! ! ( options . allChunks || isInitialOrHasNoParents ( chunk ) ) ;
146
+ const shouldExtract = ! ! ( options . allChunks ) ;
147
147
chunk . sortModules ( ) ;
148
148
async . forEach ( chunk . mapModules ( c => c ) , ( module , callback ) => { // eslint-disable-line no-shadow
149
149
let meta = module [ NS ] ;
@@ -152,7 +152,16 @@ class ExtractTextPlugin {
152
152
// A stricter `shouldExtract !== wasExtracted` check to guard against cases where a previously extracted
153
153
// module would be extracted twice. Happens when a module is a dependency of an initial and a non-initial
154
154
// chunk. See issue #604
155
- if ( shouldExtract && ! wasExtracted ) {
155
+
156
+ let cks = module . chunks ;
157
+ // check every module's chunks.parents() to decide extract or not
158
+ for ( let i = 0 ; i < cks . length ; i ++ ) {
159
+ if ( ! isInitialOrHasNoParents ( cks [ i ] ) && ! module . noExtracted ) {
160
+ module . noExtracted = 1 ;
161
+ break ;
162
+ }
163
+ }
164
+ if ( shouldExtract || ( ! module . noExtracted && ! wasExtracted ) ) {
156
165
module [ `${ NS } /extract` ] = shouldExtract ; // eslint-disable-line no-path-concat
157
166
compilation . rebuildModule ( module , ( err ) => {
158
167
if ( err ) {
You can’t perform that action at this time.
0 commit comments