Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): Correctly prints the size of the …
Browse files Browse the repository at this point in the history
…chunk during the build statistic print.

Fixes: #16627
  • Loading branch information
EmaGht authored and Keen Yee Liau committed Feb 13, 2020
1 parent fcdea5a commit 3ec40a1
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ export function statsToString(json: any, statsConfig: any) {
const changedChunksStats = json.chunks
.filter((chunk: any) => chunk.rendered)
.map((chunk: any) => {
const asset = json.assets.filter((x: any) => x.name == chunk.files[0])[0];
return generateBundleStats({ ...chunk, size: asset && asset.size }, colors);
const assets = json.assets.filter((asset: any) => chunk.files.indexOf(asset.name) != -1);
const summedSize = assets.filter((asset: any) => !asset.name.endsWith(".map")).reduce((total: number, asset: any) => { return total + asset.size }, 0);
return generateBundleStats({ ...chunk, size: summedSize }, colors);
});

const unchangedChunkNumber = json.chunks.length - changedChunksStats.length;
Expand Down

0 comments on commit 3ec40a1

Please sign in to comment.