-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Budget warnings calculated incorrectly with esbuild builder #29040
Comments
It seems that format-bytes uses multiplier 1000 but bundle calculator uses 1024. I think, it would be nice, that with 1024 multiplier the unit would be |
Patching bundle calculator to use |
Thanks @rubiesonthesky your initial investigation saved me lot of time, raised a PR to fix this issue |
This PR makes change to kB value which was incorrect earlier Fixes angular#29040
This PR makes change to kB value which was incorrect earlier Fixes angular#29040
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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: