We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 38ed278 commit 197d73dCopy full SHA for 197d73d
packages/angular_devkit/build_angular/src/webpack/utils/stats.ts
@@ -21,8 +21,10 @@ export function formatSize(size: number): string {
21
22
const abbreviations = ['bytes', 'kB', 'MB', 'GB'];
23
const index = Math.floor(Math.log(size) / Math.log(1024));
24
-
25
- return `${+(size / Math.pow(1024, index)).toPrecision(3)} ${abbreviations[index]}`;
+ const roundedSize = size / Math.pow(1024, index);
+ // bytes don't have a fraction
26
+ const fractionDigits = index === 0 ? 0 : 2;
27
+ return `${roundedSize.toFixed(fractionDigits)} ${abbreviations[index]}`;
28
}
29
30
export type BundleStatsData = [files: string, names: string, size: number | string];
0 commit comments