angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.66k stars 11.98k forks source link

Option to update budgets when building app or export list of initial chunk files #27941

Open rubiesonthesky opened 1 week ago

rubiesonthesky commented 1 week ago

Command

build

Description

When updating app, it would be nice to have a easy way to update application budgets in angular.json file. With Angular 18 and new @angular/build:application builder it's no longer possible to script this task.

I understand that this may be niche feature request. But tracking budgets helps to see, how the size changes overtime.

Describe the solution you'd like

When I run build, I'd like to have cli option that would update angular.json file and the budgets section. It's tedious to update that file manually.

Describe alternatives you've considered

I have a script for this task but it does not work with the new builder. The produced stats.json does not have enough information. There is no information which chunks are initial and which are loaded later. Also, I'm not sure how I could map the chunks to budgets in angular.json. Before the stats.json had the same chunkName and it could be just compared with the angular.json file.

This method was also nice, because I could print table that compared the values from angular.json and stats.json and see difference.

Is there a way to expose the data that builder clearly has when it prints the output table? With that data, I could update my script to work.

At least there seems to be a way to convert entryPoint to chunkName: https://github.com/angular/angular-cli/blob/5b81e0f310609ceefaa09342722163233c14b47c/packages/angular/build/src/tools/esbuild/budget-stats.ts#L46-L48

angular-robot[bot] commented 1 week ago

This feature request is now candidate for our backlog! In the next phase, the community has 60 days to upvote. If the request receives more than 20 upvotes, we'll move it to our consideration list.

You can find more details about the feature request process in our documentation.