@@ -135,7 +135,10 @@ class Stats {
135135 const showBuiltAt = optionOrLocalFallback ( options . builtAt , true ) ;
136136 const showAssets = optionOrLocalFallback ( options . assets , true ) ;
137137 const showEntrypoints = optionOrLocalFallback ( options . entrypoints , true ) ;
138- const showChunkGroups = optionOrLocalFallback ( options . chunkGroups , true ) ;
138+ const showChunkGroups = optionOrLocalFallback (
139+ options . chunkGroups ,
140+ ! forToString
141+ ) ;
139142 const showChunks = optionOrLocalFallback ( options . chunks , ! forToString ) ;
140143 const showChunkModules = optionOrLocalFallback ( options . chunkModules , true ) ;
141144 const showChunkOrigins = optionOrLocalFallback (
@@ -877,22 +880,23 @@ class Stats {
877880 colors . normal ( obj . filteredAssets !== 1 ? " assets" : " asset" ) ;
878881 newline ( ) ;
879882 }
880- if ( obj . entrypoints ) {
881- for ( const name of Object . keys ( obj . entrypoints ) ) {
882- const ep = obj . entrypoints [ name ] ;
883- colors . normal ( "Entrypoint " ) ;
883+
884+ const processChunkGroups = ( namedGroups , prefix ) => {
885+ for ( const name of Object . keys ( namedGroups ) ) {
886+ const cg = namedGroups [ name ] ;
887+ colors . normal ( `${ prefix } ` ) ;
884888 colors . bold ( name ) ;
885- if ( ep . isOverSizeLimit ) {
889+ if ( cg . isOverSizeLimit ) {
886890 colors . normal ( " " ) ;
887891 colors . yellow ( "[big]" ) ;
888892 }
889893 colors . normal ( " =" ) ;
890- for ( const asset of ep . assets ) {
894+ for ( const asset of cg . assets ) {
891895 colors . normal ( " " ) ;
892896 colors . green ( asset ) ;
893897 }
894- for ( const name of Object . keys ( ep . childAssets ) ) {
895- const assets = ep . childAssets [ name ] ;
898+ for ( const name of Object . keys ( cg . childAssets ) ) {
899+ const assets = cg . childAssets [ name ] ;
896900 if ( assets && assets . length > 0 ) {
897901 colors . normal ( " " ) ;
898902 colors . magenta ( `(${ name } :` ) ;
@@ -905,7 +909,25 @@ class Stats {
905909 }
906910 newline ( ) ;
907911 }
912+ } ;
913+
914+ if ( obj . entrypoints ) {
915+ processChunkGroups ( obj . entrypoints , "Entrypoint" ) ;
908916 }
917+
918+ if ( obj . namedChunkGroups ) {
919+ let outputChunkGroups = obj . namedChunkGroups ;
920+ if ( obj . entrypoints ) {
921+ outputChunkGroups = Object . keys ( outputChunkGroups )
922+ . filter ( name => ! obj . entrypoints [ name ] )
923+ . reduce ( ( result , name ) => {
924+ result [ name ] = obj . namedChunkGroups [ name ] ;
925+ return result ;
926+ } , { } ) ;
927+ }
928+ processChunkGroups ( outputChunkGroups , "Chunk Group" ) ;
929+ }
930+
909931 const modulesByIdentifier = { } ;
910932 if ( obj . modules ) {
911933 for ( const module of obj . modules ) {
@@ -1271,6 +1293,7 @@ class Stats {
12711293 case "verbose" :
12721294 return {
12731295 entrypoints : true ,
1296+ chunkGroups : true ,
12741297 modules : false ,
12751298 chunks : true ,
12761299 chunkModules : true ,
@@ -1289,6 +1312,7 @@ class Stats {
12891312 case "detailed" :
12901313 return {
12911314 entrypoints : true ,
1315+ chunkGroups : true ,
12921316 chunks : true ,
12931317 chunkModules : false ,
12941318 chunkOrigins : true ,
0 commit comments