@@ -107,7 +107,7 @@ You can however specify the name of the async chunk by passing the desired strin
107107 /**
108108 * These chunks are subject to get "common" modules extracted and moved to the common chunk
109109 */
110- const affectedChunks = this . getAffectedChunks ( compilation , chunks , targetChunk , targetChunks , idx , this . selectedChunks , this . async , this . deepChildren , this . children ) ;
110+ const affectedChunks = this . getAffectedChunks ( compilation , chunks , targetChunk , targetChunks , idx , this . selectedChunks , this . async , this . children , this . deepChildren ) ;
111111
112112 // bail if no chunk is affected
113113 if ( ! affectedChunks ) {
@@ -214,7 +214,7 @@ You can however specify the name of the async chunk by passing the desired strin
214214Take a look at the "name"/"names" or async/children option.` ) ;
215215 }
216216
217- getAffectedUnnamedChunks ( affectedChunks , targetChunk , asyncOption , deepChildrenOption ) {
217+ getAffectedUnnamedChunks ( affectedChunks , targetChunk , rootChunk , asyncOption , deepChildrenOption ) {
218218 for ( const chunk of targetChunk . chunksIterable ) {
219219 if ( chunk . isInitial ( ) ) {
220220 continue ;
@@ -224,11 +224,11 @@ Take a look at the "name"/"names" or async/children option.`);
224224 // b) themselves affected chunks
225225 // we can assume that this chunk is an affected chunk too, as there is no way a chunk that
226226 // isn't only depending on the target chunk is a parent of the chunk tested
227- if ( asyncOption || chunk . getParents ( ) . every ( ( parentChunk ) => parentChunk === targetChunk || affectedChunks . has ( parentChunk ) ) ) {
227+ if ( asyncOption || chunk . getParents ( ) . every ( ( parentChunk ) => parentChunk === rootChunk || affectedChunks . has ( parentChunk ) ) ) {
228228 // This check not only dedupes the affectedChunks but also guarantees we avoid endless loops
229- if ( ! affectedChunks . has ( chunk ) || affectedChunks . values ( ) . next ( ) . value === chunk ) {
229+ if ( ! affectedChunks . has ( chunk ) ) {
230230 // We mutate the affected chunks before going deeper, so the deeper levels and other branches
231- // Have the information of this chunk being affected for their assertion if a chunk should
231+ // have the information of this chunk being affected for their assertion if a chunk should
232232 // not be affected
233233 affectedChunks . add ( chunk ) ;
234234
@@ -237,15 +237,15 @@ Take a look at the "name"/"names" or async/children option.`);
237237 // at the latest the last connection to the same chunk meets the
238238 // condition to add it to the affected chunks.
239239 if ( deepChildrenOption === true ) {
240- this . getAffectedUnnamedChunks ( affectedChunks , chunk , asyncOption , deepChildrenOption ) ;
240+ this . getAffectedUnnamedChunks ( affectedChunks , chunk , rootChunk , asyncOption , deepChildrenOption ) ;
241241 }
242242 }
243243 }
244244 }
245245 }
246246
247- getAffectedChunks ( compilation , allChunks , targetChunk , targetChunks , currentIndex , selectedChunks , asyncOption , deepChildrenOption , children ) {
248- const asyncOrNoSelectedChunk = children || asyncOption ;
247+ getAffectedChunks ( compilation , allChunks , targetChunk , targetChunks , currentIndex , selectedChunks , asyncOption , childrenOption , deepChildrenOption ) {
248+ const asyncOrNoSelectedChunk = childrenOption || asyncOption ;
249249
250250 if ( Array . isArray ( selectedChunks ) ) {
251251 return allChunks . filter ( chunk => {
@@ -257,7 +257,7 @@ Take a look at the "name"/"names" or async/children option.`);
257257
258258 if ( asyncOrNoSelectedChunk ) {
259259 let affectedChunks = new Set ( ) ;
260- this . getAffectedUnnamedChunks ( affectedChunks , targetChunk , asyncOption , deepChildrenOption ) ;
260+ this . getAffectedUnnamedChunks ( affectedChunks , targetChunk , targetChunk , asyncOption , deepChildrenOption ) ;
261261 return Array . from ( affectedChunks ) ;
262262 }
263263
0 commit comments