@@ -11,8 +11,11 @@ import { logging, tags } from '@angular-devkit/core';
11
11
import * as path from 'path' ;
12
12
import * as textTable from 'text-table' ;
13
13
import { Configuration , StatsCompilation } from 'webpack' ;
14
+ import { Schema as BrowserBuilderOptions } from '../../browser/schema' ;
14
15
import { colors as ansiColors , removeColor } from '../../utils/color' ;
15
16
import { getWebpackStatsConfig } from '../configs/stats' ;
17
+ import { markAsyncChunksNonInitial } from './async-chunks' ;
18
+ import { normalizeExtraEntryPoints } from './helpers' ;
16
19
17
20
export function formatSize ( size : number ) : string {
18
21
if ( size <= 0 ) {
@@ -325,15 +328,27 @@ export function statsHasWarnings(json: StatsCompilation): boolean {
325
328
}
326
329
327
330
export function createWebpackLoggingCallback (
328
- verbose : boolean ,
331
+ options : BrowserBuilderOptions ,
329
332
logger : logging . LoggerApi ,
330
333
) : WebpackLoggingCallback {
334
+ const { verbose = false , scripts = [ ] , styles = [ ] } = options ;
335
+ const extraEntryPoints = [
336
+ ...normalizeExtraEntryPoints ( styles , 'styles' ) ,
337
+ ...normalizeExtraEntryPoints ( scripts , 'scripts' ) ,
338
+ ] ;
339
+
331
340
return ( stats , config ) => {
332
341
if ( verbose ) {
333
342
logger . info ( stats . toString ( config . stats ) ) ;
334
343
}
335
344
336
- webpackStatsLogger ( logger , stats . toJson ( getWebpackStatsConfig ( false ) ) , config ) ;
345
+ const rawStats = stats . toJson ( getWebpackStatsConfig ( false ) ) ;
346
+ const webpackStats = {
347
+ ...rawStats ,
348
+ chunks : markAsyncChunksNonInitial ( rawStats , extraEntryPoints ) ,
349
+ } ;
350
+
351
+ webpackStatsLogger ( logger , webpackStats , config ) ;
337
352
} ;
338
353
}
339
354
0 commit comments