Budget warnings calculated incorrectly with esbuild builder #29040
Labels
angular/build:application
area: @angular/build
freq1: low
Only reported by a handful of users who observe it rarely
severity5: regression
type: bug/fix
Command
build
Is this a regression?
The previous version in which this bug was not present was
18 (Well, with webpack, I did not test esbuild builder with Angular 18)
Description
This inconsistency is between esbuild and webpack builders. I have set that "styles" budget is
310.82kB
, but I get warning while building sayingstyles failed to meet minimum budget. Budget 317.25 kB was not met by 6.44 kB with a total of 310.82 kB.
.After writing scripts to calculate these sizes myself, it seems that in version 18 with webpack builder, bytes where converted to
kB
with multiplier1024
. With esbuild, it seems thatkB
sizes are calculated with multiplied1000
. So whenstats.json
saysbytes: 34607
, you need to multiply it with 1000 to get the same size thatbuild
report givesBut then it gives warnings
My
angular.json
has thisSo I think those warnings are reported incorrectly. It seems that the values are taken from
angular.json
and then multiplied to get317.25 kB
and35.34 kB
when they should not be multiplied.Minimal Reproduction
I can repro this with new Angular 19 app, which uses
"builder": "@angular-devkit/build-angular:application",
I added budget constraint to
angular.json
After which I get warning
Exception or Error
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: