File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -198,27 +198,12 @@ class Chunk {
198198 otherModules . forEach ( m => other . moveModule ( m , this ) ) ;
199199 other . modules . length = 0 ;
200200
201- const moveChunks = ( chunks , kind , onChunk ) => {
202- chunks . forEach ( c => {
203- const idx = c [ kind ] . indexOf ( other ) ;
204- if ( idx >= 0 ) {
205- c [ kind ] . splice ( idx , 1 ) ;
206- }
207- onChunk ( c ) ;
208- } ) ;
209- } ;
210- moveChunks ( other . parents , "chunks" , c => {
211- if ( c !== this && this . addParent ( c ) ) {
212- c . addChunk ( this ) ;
213- }
214- } ) ;
201+ other . parents . forEach ( parent => parent . replaceChunk ( other , this ) ) ;
215202 other . parents . length = 0 ;
216- moveChunks ( other . chunks , "parents" , c => {
217- if ( c !== this && this . addChunk ( c ) ) {
218- c . addParent ( this ) ;
219- }
220- } ) ;
203+
204+ other . chunks . forEach ( chunk => chunk . replaceParent ( other , this ) ) ;
221205 other . chunks . length = 0 ;
206+
222207 other . blocks . forEach ( b => {
223208 b . chunks = ( b . chunks || [ this ] ) . map ( c => {
224209 return c === other ? this : c ;
You can’t perform that action at this time.
0 commit comments