feat(@angular/build): enable chunk optimization for server builds#33602
Open
jsaguet wants to merge 1 commit into
Open
feat(@angular/build): enable chunk optimization for server builds#33602jsaguet wants to merge 1 commit into
jsaguet wants to merge 1 commit into
Conversation
jsaguet
marked this pull request as ready for review
July 19, 2026 08:01
There was a problem hiding this comment.
Code Review
This pull request enables chunk optimization for server builds by removing the restriction on server entry points during the build execution. It also introduces a new behavior test suite to verify chunk optimization with server entry points and updates existing E2E tests to dynamically validate that preload links are generated and resolve correctly. The review feedback suggests improving the robustness of a regular expression in the new test file by removing a strict trailing comma requirement.
The chunk optimization pass was disabled when a server entry point was present due to a concern that renamed browser chunks would cause incorrect preloading. The preload metadata (route tree preload arrays and entryPointToBrowserMapping in the server app manifest) is generated after the optimization pass from the optimized metafile, so renamed and merged chunks stay consistent with the emitted files. A behavior test now asserts that the server manifest only references browser chunks that exist after optimization and that every lazy route retains its entry point mapping. The server-routes-preload-links e2e test now verifies that every route of an optimized build emits preload links that resolve successfully, instead of only checking the root route.
jsaguet
force-pushed
the
feat/enable-server-optimizer
branch
from
July 19, 2026 08:11
9458788 to
87f0e56
Compare
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.
The chunk optimization pass was disabled when a server entry point was present due to a concern that renamed browser chunks would cause incorrect preloading. The preload metadata (route tree preload arrays and entryPointToBrowserMapping in the server app manifest) is generated after the optimization pass from the optimized metafile, so renamed and merged chunks stay consistent with the emitted files.
A behavior test now asserts that the server manifest only references browser chunks that exist after optimization and that every lazy route retains its entry point mapping. The server-routes-preload-links e2e test now verifies that every route of an optimized build emits preload links that resolve successfully, instead of only checking the root route.
Fixes #33438
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?
Chunk optimization is never used for SSR builds.
What is the new behavior?
Chunk optimization is used for SSR builds
Does this PR introduce a breaking change?
Other information