feat(@angular/build): Support splitting browser and server stats jsonfiles for easier consumption - #33870
Open
alan-agius4 wants to merge 2 commits into
Open
feat(@angular/build): Support splitting browser and server stats jsonfiles for easier consumption#33870alan-agius4 wants to merge 2 commits into
alan-agius4 wants to merge 2 commits into
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 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.
alan-agius4
force-pushed
the
stats-sep
branch
3 times, most recently
from
August 17, 2026 13:38
9f9ef20 to
9f8f54c
Compare
alan-agius4
marked this pull request as ready for review
August 17, 2026 16:51
There was a problem hiding this comment.
Code Review
This pull request refactors the application builder to separate browser and server metafiles instead of merging them into a single metafile, enabling the generation of separate browser and server stats files. Feedback on these changes highlights two issues: first, removing the server bundle exclusion check in generateBudgetStats incorrectly includes server files in budget calculations, which should be resolved by filtering outputFiles beforehand; second, removing the BuildOutputFileType.Browser check in chunk-optimizer.ts allows server-side files to be added to chunk records, introducing unnecessary overhead.
…ndler context Track the target platform (`browser` or `server`) on individual bundler context results and introduce `BundleMergedContextResult` to maintain separate `browser` and `server` metafiles when merging. This simplifies downstream consumers: - Enables direct usage of `metafiles.browser` for browser-specific steps (budgets, i18n, chunk optimization, CommonJS checks, and post-bundle processing). - Allows `extractLicenses` and `logBuildStats` to process all platform metafiles directly without merging them into a single structure. - Removes redundant filtering of server bundles in budget calculations. - Streamlines the `statsJson` file emission for browser and server targets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.