@@ -270,8 +270,8 @@ class Compilation extends Tapable {
270270 cacheModule . disconnect ( ) ;
271271 this . _modules . set ( identifier , cacheModule ) ;
272272 this . modules . push ( cacheModule ) ;
273- cacheModule . errors . forEach ( err => this . errors . push ( err ) ) ;
274- cacheModule . warnings . forEach ( err => this . warnings . push ( err ) ) ;
273+ for ( const err of cacheModule . errors ) this . errors . push ( err ) ;
274+ for ( const err of cacheModule . warnings ) this . warnings . push ( err ) ;
275275 return {
276276 module : cacheModule ,
277277 issuer : true ,
@@ -323,7 +323,7 @@ class Compilation extends Tapable {
323323
324324 const callback = err => {
325325 this . _buildingModules . delete ( module ) ;
326- callbackList . forEach ( cb => cb ( err ) ) ;
326+ for ( const cb of callbackList ) cb ( err ) ;
327327 } ;
328328
329329 this . hooks . buildModule . call ( module ) ;
@@ -691,7 +691,7 @@ class Compilation extends Tapable {
691691
692692 const callback = err => {
693693 this . _rebuildingModules . delete ( module ) ;
694- callbackList . forEach ( cb => cb ( err ) ) ;
694+ for ( const cb of callbackList ) cb ( err ) ;
695695 } ;
696696
697697 this . hooks . rebuildModule . call ( module ) ;
@@ -737,7 +737,9 @@ class Compilation extends Tapable {
737737 this . namedChunkGroups . clear ( ) ;
738738 this . additionalChunkAssets . length = 0 ;
739739 this . assets = { } ;
740- this . modules . forEach ( module => module . unseal ( ) ) ;
740+ for ( const module of this . modules ) {
741+ module . unseal ( ) ;
742+ }
741743 }
742744
743745 seal ( callback ) {
@@ -750,7 +752,7 @@ class Compilation extends Tapable {
750752
751753 this . nextFreeModuleIndex = 0 ;
752754 this . nextFreeModuleIndex2 = 0 ;
753- this . _preparedEntrypoints . forEach ( preparedEntrypoint => {
755+ for ( const preparedEntrypoint of this . _preparedEntrypoints ) {
754756 const module = preparedEntrypoint . module ;
755757 const name = preparedEntrypoint . name ;
756758 const chunk = this . addChunk ( name ) ;
@@ -769,7 +771,7 @@ class Compilation extends Tapable {
769771
770772 this . assignIndex ( module ) ;
771773 this . assignDepth ( module ) ;
772- } ) ;
774+ }
773775 this . processDependenciesBlocksForChunkGroups ( this . chunkGroups ) ;
774776 this . sortModules ( this . modules ) ;
775777 this . hooks . optimize . call ( ) ;
@@ -1513,11 +1515,11 @@ class Compilation extends Tapable {
15131515 addAllToSet ( this . contextDependencies , module . buildInfo . contextDependencies ) ;
15141516 }
15151517 }
1516- this . errors . forEach ( error => {
1518+ for ( const error of this . errors ) {
15171519 if ( typeof error . missing === "object" && error . missing && error . missing [ Symbol . iterator ] ) {
15181520 addAllToSet ( this . missingDependencies , error . missing ) ;
15191521 }
1520- } ) ;
1522+ }
15211523 this . fileDependencies . sort ( ) ;
15221524 this . contextDependencies . sort ( ) ;
15231525 this . missingDependencies . sort ( ) ;
@@ -1533,10 +1535,10 @@ class Compilation extends Tapable {
15331535 hash . update ( outputOptions . hashSalt ) ;
15341536 this . mainTemplate . updateHash ( hash ) ;
15351537 this . chunkTemplate . updateHash ( hash ) ;
1536- Object . keys ( this . moduleTemplates ) . sort ( ) . forEach ( key => this . moduleTemplates [ key ] . updateHash ( hash ) ) ;
1537- this . children . forEach ( child => hash . update ( child . hash ) ) ;
1538- this . warnings . forEach ( warning => hash . update ( `${ warning . message } ` ) ) ;
1539- this . errors . forEach ( error => hash . update ( `${ error . message } ` ) ) ;
1538+ for ( const key of Object . keys ( this . moduleTemplates ) . sort ( ) ) this . moduleTemplates [ key ] . updateHash ( hash ) ;
1539+ for ( const child of this . children ) hash . update ( child . hash ) ;
1540+ for ( const warning of this . warnings ) hash . update ( `${ warning . message } ` ) ;
1541+ for ( const error of this . errors ) hash . update ( `${ error . message } ` ) ;
15401542 const modules = this . modules ;
15411543 for ( let i = 0 ; i < modules . length ; i ++ ) {
15421544 const module = modules [ i ] ;
@@ -1595,11 +1597,11 @@ class Compilation extends Tapable {
15951597 for ( let i = 0 ; i < this . modules . length ; i ++ ) {
15961598 const module = this . modules [ i ] ;
15971599 if ( module . buildInfo . assets ) {
1598- Object . keys ( module . buildInfo . assets ) . forEach ( ( assetName ) => {
1600+ for ( const assetName of Object . keys ( module . buildInfo . assets ) ) {
15991601 const fileName = this . getPath ( assetName ) ;
16001602 this . assets [ fileName ] = module . buildInfo . assets [ assetName ] ;
16011603 this . hooks . moduleAsset . call ( module , fileName ) ;
1602- } ) ;
1604+ }
16031605 }
16041606 }
16051607 }
0 commit comments