feat(@angular/build): Support splitting browser and server stats jsonfiles for easier consumption#32989
feat(@angular/build): Support splitting browser and server stats jsonfiles for easier consumption#32989tsteuwer-accesso wants to merge 5 commits intoangular:mainfrom
Conversation
… 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. Today, everything gets dumped into a single file and it's nearly impossible to use without hours of fix -> remove unused browser 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. Fixes angular#28185 angular#28671
…at was in my main branch off of @angular/angular-cli repository This addresses an issue of including the (browser|server)-initial-stats.json file that was in my original repository. It also fixes unit tests that were also addressed in the original repo.
|
@alan-agius4 , made the requested changes. Let me know if there's anything else. |
There was a problem hiding this comment.
Code Review
This pull request refactors the build process to generate separate and filtered stats files for browser and server outputs, replacing the single stats.json with more granular files like browser-stats.json and browser-initial-stats.json. The changes include updates to the application builder, esbuild bundling context, and Webpack configuration. Feedback highlights an opportunity to refactor the metafile filtering logic into a shared utility to reduce code duplication. Additionally, it was noted that the Webpack implementation currently produces a duplicate file for initial stats instead of a filtered one, which should be addressed to ensure feature parity with the esbuild implementation.
This feature supports splitting out the browser and server stats json files so it's easier to inspect the bundle in various analyzers. 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.
Fixes #28185 #28671
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 single stats.json file.Issue Number: #28185
What is the new behavior?
We now receive a
browser-stats.json,server-stats.json,browser-initial-stats.jsonandserver-initial-stats.jsonDoes this PR introduce a breaking change?
This is a breaking change for anyone relying on CI processes that inspect the old
stats.jsonfile as it will no longer be named that.Other information