feat(@angular/build): Support splitting browser and server stats json files for easier consumption#33209
feat(@angular/build): Support splitting browser and server stats json files for easier consumption#33209tsteuwer-accesso wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the application builder to generate four distinct stats files—browser-stats.json, browser-initial-stats.json, server-stats.json, and server-initial-stats.json—replacing the previous single stats.json output. The changes introduce infrastructure to track separate browser and server metafiles throughout the bundling process and include a new utility to filter these metafiles for initial files. Feedback was provided regarding the browserMetafile reconstruction logic in chunk-optimizer.ts, suggesting an explicit check for input existence to ensure consistency and prevent potential undefined assignments.
Sorry, something went wrong.
…files for easier consumption This feature supports splitting out the browser and server stats json files so it's easier to inspect the bundle in various analyzers and addresses angular#28185 angular#28671. Today, everything gets dumped into a single file and it's nearly impossible to use without hours of `fix -> remove unused browser/server chunks -> analyze` and starting the loop all over again. This feature implements the feature request I made in angular#28185, along with another developers request to see a stats json file for just the initial page bundle. I've tested this out in my own repository and it's already helped an incredible amount. This will be required to be in the next Major version as it will break any existing build pipeline that relies on a single stats.json file.
|
Commenting to ensure this doesn't go stale and get closed again. |
Sorry, something went wrong.
This feature supports splitting out the browser and server stats json files so it's easier to inspect the bundle in various analyzers and addresses #28185 #28671. Today, everything gets dumped into a single file and it's nearly impossible to use without hours of
fix -> remove unused browser/server chunks -> analyzeand starting the loop all over again.This feature implements the feature request I made in #28185, along with another developers request to see a stats json file for just the initial page bundle. I've tested this out in my own repository and it's already helped an incredible amount. This will be required to be in the next Major version as it will break any existing build pipeline that relies on a single stats.json file.
PR Checklist
Please check to confirm your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
When using
--stats-json, the CLI outputs a singlestats.jsonfile.Issue Number: #28185
What is the new behavior?
When using
--stats-json, the CLI now outputs four separate files:browser-stats.jsonThe full browser stats.jsonbrowser-initial-stats.jsonJust the files that will be delivered on the main request.server-stats.jsonSSR versionserver-initial-stats.jsonSSR versionDoes this PR introduce a breaking change?
If anyone is relying on there being a single
stats.jsonfile, then this will break their existing pipelines as there will be four files now and they aren't the same name as before.Other information