-
Notifications
You must be signed in to change notification settings - Fork 12k
/
Copy pathstats.ts
53 lines (47 loc) · 1.42 KB
/
stats.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { WebpackConfigOptions } from '../build-options';
const webpackOutputOptions = {
colors: true,
hash: true, // required by custom stat output
timings: true, // required by custom stat output
chunks: true, // required by custom stat output
chunkModules: false,
children: false, // listing all children is very noisy in AOT and hides warnings/errors
modules: false,
reasons: false,
warnings: true,
errors: true,
assets: true, // required by custom stat output
version: false,
errorDetails: false,
moduleTrace: false,
};
const verboseWebpackOutputOptions = {
// The verbose output will most likely be piped to a file, so colors just mess it up.
colors: false,
usedExports: true,
maxModules: Infinity,
optimizationBailout: true,
reasons: true,
children: true,
assets: true,
version: true,
chunkModules: true,
errorDetails: true,
moduleTrace: true,
};
export function getWebpackStatsConfig(verbose = false) {
return verbose
? Object.assign(webpackOutputOptions, verboseWebpackOutputOptions)
: webpackOutputOptions;
}
export function getStatsConfig(wco: WebpackConfigOptions) {
const verbose = !!wco.buildOptions.verbose;
return { stats: getWebpackStatsConfig(verbose) };
}