@@ -47,7 +47,7 @@ The available options are:
4747 const minSize = this . minSize ;
4848 const ident = this . ident ;
4949 compiler . plugin ( "this-compilation" , ( compilation ) => {
50- compilation . plugin ( [ "optimize-chunks" , "optimize-extracted-chunks" ] , function ( chunks ) {
50+ compilation . plugin ( [ "optimize-chunks" , "optimize-extracted-chunks" ] , ( chunks ) => {
5151 // only optimize once
5252 if ( compilation [ ident ] ) return ;
5353 compilation [ ident ] = true ;
@@ -57,11 +57,9 @@ The available options are:
5757 commonChunks = chunks ;
5858 } else if ( Array . isArray ( chunkNames ) || typeof chunkNames === "string" ) {
5959 commonChunks = [ ] . concat ( chunkNames ) . map ( ( chunkName ) => {
60- let chunk = chunks . filter ( function ( chunk ) {
61- return chunk . name === chunkName ;
62- } ) [ 0 ] ;
60+ let chunk = chunks . filter ( ( chunk ) => chunk . name === chunkName ) [ 0 ] ;
6361 if ( ! chunk ) {
64- chunk = this . addChunk ( chunkName ) ;
62+ chunk = compilation . addChunk ( chunkName ) ;
6563 }
6664 return chunk ;
6765 } , this ) ;
@@ -101,8 +99,8 @@ The available options are:
10199 if ( minChunks !== Infinity ) {
102100 const commonModulesCount = [ ] ;
103101 const commonModules = [ ] ;
104- usedChunks . forEach ( function ( chunk ) {
105- chunk . modules . forEach ( function ( module ) {
102+ usedChunks . forEach ( ( chunk ) => {
103+ chunk . modules . forEach ( ( module ) => {
106104 const idx = commonModules . indexOf ( module ) ;
107105 if ( idx < 0 ) {
108106 commonModules . push ( module ) ;
@@ -152,7 +150,7 @@ The available options are:
152150 } ) ;
153151 }
154152 asyncChunk . origins = Array . from ( reallyUsedChunks ) . map ( ( chunk ) => {
155- return chunk . origins . map ( function ( origin ) {
153+ return chunk . origins . map ( ( origin ) => {
156154 const newOrigin = Object . create ( origin ) ;
157155 newOrigin . reasons = ( origin . reasons || [ ] ) . slice ( ) ;
158156 newOrigin . reasons . push ( "async commons" ) ;
@@ -173,7 +171,7 @@ The available options are:
173171 }
174172 if ( filenameTemplate )
175173 commonChunk . filenameTemplate = filenameTemplate ;
176- } , this ) ;
174+ } ) ;
177175 return true ;
178176 } ) ;
179177 } ) ;
0 commit comments