@@ -19,43 +19,46 @@ export default function logger(stats: any, config: any, runningMessage: string =
1919 let chunks : undefined | string [ ] ;
2020
2121 let chunkMap : { [ chunk : string ] : any } ;
22+ const excludeChunks = / ( ^ b o o t s t r a p $ ) | ( ^ r u n t i m e \/ ) / ;
2223 if ( args . mode === 'dist' ) {
2324 chunkMap = analyzeBundles ( stats , config , {
2425 analyzerMode : 'static' ,
2526 openAnalyzer : false ,
2627 generateStatsFile : true ,
2728 reportFilename : '../info/report.html' ,
2829 statsFilename : '../info/stats.json' ,
29- excludeBundles : '(^bootstrap.)|(^runtime/)'
30+ excludeBundles : '(^bootstrap\\ .)|(^runtime/)'
3031 } ) ;
3132 }
3233 chunks = ( Array . isArray ( config )
3334 ? loggerStats . children . reduce ( ( chunks : any [ ] , current : any ) => [ ...chunks , ...current . chunks ] , [ ] )
3435 : loggerStats . chunks
35- ) . map ( ( chunk : any ) => {
36- const chunkName : string = chunk . names [ 0 ] ;
37- if ( ! chunkMap ) {
38- return chunkName ;
39- } else {
40- const chunkStats = chunkMap [ chunkName ] ;
41- const size = ( ( chunkStats && ( chunkStats . parsedSize || chunkStats . statSize ) ) || 0 ) / 1000 ;
42- const gzipSize = ( ( chunkStats && chunkStats . gzipSize ) || 0 ) / 1000 ;
36+ )
37+ . filter ( ( chunk : any ) => ! excludeChunks . test ( chunk . names [ 0 ] || '' ) )
38+ . map ( ( chunk : any ) => {
39+ const chunkName : string = chunk . names [ 0 ] ;
40+ if ( ! chunkMap ) {
41+ return chunkName ;
42+ } else {
43+ const chunkStats = chunkMap [ chunkName ] ;
44+ const size = ( ( chunkStats && ( chunkStats . parsedSize || chunkStats . statSize ) ) || 0 ) / 1000 ;
45+ const gzipSize = ( ( chunkStats && chunkStats . gzipSize ) || 0 ) / 1000 ;
4346
44- const chunkInfo = `${ chunkName } ${ chalk . yellow ( `(${ size } kB)` ) } ${
45- gzipSize ? `/ ${ chalk . blue ( `(${ gzipSize } kB gz)` ) } ` : ''
46- } `;
47+ const chunkInfo = `${ chunkName } ${ chalk . yellow ( `(${ size } kB)` ) } ${
48+ gzipSize ? ` / ${ chalk . blue ( `(${ gzipSize } kB gz)` ) } ` : ''
49+ } `;
4750
48- if ( size > 250 ) {
49- const largestPackage = findLargestPackage ( chunkStats ) ;
50- if ( largestPackage ) {
51- return `${ chunkInfo } \nLargest dependency is ${ largestPackage . name } (${ chalk . yellow (
52- `${ largestPackage . size / 1000 } kB`
53- ) } )`;
51+ if ( size > 250 ) {
52+ const largestPackage = findLargestPackage ( chunkStats ) ;
53+ if ( largestPackage ) {
54+ return `${ chunkInfo } \nLargest dependency is ${ largestPackage . name } ${ chalk . yellow (
55+ `(${ largestPackage . size / 1000 } kB)`
56+ ) } `;
57+ }
5458 }
59+ return chunkInfo ;
5560 }
56- return chunkInfo ;
57- }
58- } ) ;
61+ } ) ;
5962
6063 let errors = '' ;
6164 let warnings = '' ;
0 commit comments