@@ -19,43 +19,46 @@ export default function logger(stats: any, config: any, runningMessage: string =
19
19
let chunks : undefined | string [ ] ;
20
20
21
21
let chunkMap : { [ chunk : string ] : any } ;
22
+ const excludeChunks = / ( ^ b o o t s t r a p $ ) | ( ^ r u n t i m e \/ ) / ;
22
23
if ( args . mode === 'dist' ) {
23
24
chunkMap = analyzeBundles ( stats , config , {
24
25
analyzerMode : 'static' ,
25
26
openAnalyzer : false ,
26
27
generateStatsFile : true ,
27
28
reportFilename : '../info/report.html' ,
28
29
statsFilename : '../info/stats.json' ,
29
- excludeBundles : '(^bootstrap.)|(^runtime/)'
30
+ excludeBundles : '(^bootstrap\\ .)|(^runtime/)'
30
31
} ) ;
31
32
}
32
33
chunks = ( Array . isArray ( config )
33
34
? loggerStats . children . reduce ( ( chunks : any [ ] , current : any ) => [ ...chunks , ...current . chunks ] , [ ] )
34
35
: 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 ;
43
46
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
+ } `;
47
50
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
+ }
54
58
}
59
+ return chunkInfo ;
55
60
}
56
- return chunkInfo ;
57
- }
58
- } ) ;
61
+ } ) ;
59
62
60
63
let errors = '' ;
61
64
let warnings = '' ;
0 commit comments