@@ -553,19 +553,29 @@ Compilation.prototype.addChunk = function addChunk(name, module, loc) {
553553} ;
554554
555555Compilation . prototype . processDependenciesBlockForChunk = function processDependenciesBlockForChunk ( block , chunk ) {
556- block . blocks . forEach ( function ( b ) {
557- var c ;
558- if ( ! b . chunk ) {
559- c = this . addChunk ( b . chunkName , b . module , b . loc ) ;
560- b . chunk = c ;
561- c . addBlock ( b ) ;
562- } else {
563- c = b . chunk ;
564- }
565- chunk . addChunk ( c ) ;
566- c . addParent ( chunk ) ;
567- this . processDependenciesBlockForChunk ( b , c ) ;
568- } , this ) ;
556+ if ( block . blocks ) {
557+ block . blocks . forEach ( function ( b ) {
558+ var c ;
559+ if ( ! b . chunk ) {
560+ c = this . addChunk ( b . chunkName , b . module , b . loc ) ;
561+ b . chunk = c ;
562+ c . addBlock ( b ) ;
563+ } else {
564+ c = b . chunk ;
565+ }
566+ chunk . addChunk ( c ) ;
567+ c . addParent ( chunk ) ;
568+ this . processDependenciesBlockForChunk ( b , c ) ;
569+ } , this ) ;
570+ }
571+ if ( block . dependencies ) {
572+ block . dependencies . forEach ( iteratorDependency , this ) ;
573+ }
574+ if ( block . variables ) {
575+ block . variables . forEach ( function ( v ) {
576+ v . dependencies . forEach ( iteratorDependency , this ) ;
577+ } , this ) ;
578+ }
569579 function iteratorDependency ( d ) {
570580 if ( ! d . module || d . weak ) {
571581 return ;
@@ -579,10 +589,6 @@ Compilation.prototype.processDependenciesBlockForChunk = function processDepende
579589 this . processDependenciesBlockForChunk ( d . module , chunk ) ;
580590 }
581591 }
582- block . dependencies . forEach ( iteratorDependency , this ) ;
583- block . variables . forEach ( function ( v ) {
584- v . dependencies . forEach ( iteratorDependency , this ) ;
585- } , this ) ;
586592} ;
587593
588594Compilation . prototype . removeChunkFromDependencies = function removeChunkFromDependencies ( block , chunk ) {
0 commit comments