Skip to content

Commit 021c986

Browse files
committed
fix(@angular-devkit/build-webpack): provide more complete compilation stats
1 parent fd12479 commit 021c986

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

packages/angular_devkit/build_webpack/src/utils.ts

+3-10
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as path from 'path';
1010
import * as webpack from 'webpack';
1111

1212
export interface EmittedFiles {
13+
id?: string;
1314
name?: string;
1415
file: string;
1516
initial: boolean;
@@ -20,19 +21,11 @@ export interface EmittedFiles {
2021
export function getEmittedFiles(compilation: webpack.compilation.Compilation): EmittedFiles[] {
2122
const files: EmittedFiles[] = [];
2223

23-
// entrypoints might have multiple outputs
24-
// such as runtime.js
25-
for (const [name, entrypoint] of compilation.entrypoints) {
26-
const entryFiles: string[] = (entrypoint && entrypoint.getFiles()) || [];
27-
for (const file of entryFiles) {
28-
files.push({ name, file, extension: path.extname(file), initial: true });
29-
}
30-
}
31-
3224
// adds all chunks to the list of emitted files such as lazy loaded modules
33-
for (const chunk of Object.values(compilation.chunks)) {
25+
for (const chunk of compilation.chunks as webpack.compilation.Chunk[]) {
3426
for (const file of chunk.files as string[]) {
3527
files.push({
28+
id: chunk.id.toString(),
3629
name: chunk.name,
3730
file,
3831
extension: path.extname(file),

packages/angular_devkit/build_webpack/src/webpack/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface WebpackFactory {
2727

2828
export type BuildResult = BuilderOutput & {
2929
emittedFiles?: EmittedFiles[];
30+
webpackStats?: webpack.Stats.ToJsonOutput;
3031
};
3132

3233
export function runWebpack(
@@ -59,6 +60,7 @@ export function runWebpack(
5960

6061
obs.next({
6162
success: !stats.hasErrors(),
63+
webpackStats: stats.toJson(),
6264
emittedFiles: getEmittedFiles(stats.compilation),
6365
} as unknown as BuildResult);
6466

0 commit comments

Comments
 (0)