Skip to content

feat(@angular/build): enable chunk optimization by default with heuristics#32971

Draft
clydin wants to merge 2 commits intoangular:mainfrom
clydin:application/chunk-opt-stable
Draft

feat(@angular/build): enable chunk optimization by default with heuristics#32971
clydin wants to merge 2 commits intoangular:mainfrom
clydin:application/chunk-opt-stable

Conversation

@clydin
Copy link
Copy Markdown
Member

@clydin clydin commented Apr 9, 2026

Enable the advanced chunk optimization pass by default for applications with multiple lazy chunks to improve loading performance. A heuristic is introduced that automatically triggers this optimization when the build generates 3 or more lazy chunks. Developers can customize this behavior or disable it entirely using the NG_BUILD_OPTIMIZE_CHUNKS environment variable. Setting it to a number adjusts the threshold of lazy chunks required to trigger optimization, while setting it to false disables the feature if issues arise in specific projects.

@clydin clydin added the target: major This PR is targeted for the next major release label Apr 9, 2026
@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: @angular/build labels Apr 9, 2026
@clydin clydin force-pushed the application/chunk-opt-stable branch 4 times, most recently from 2ade868 to ae4b8c3 Compare April 9, 2026 13:50
clydin added 2 commits April 9, 2026 10:06
This commit transitions the chunk optimization logic in the application builder from the experimental Rolldown bundler to the stable Rollup bundler. Rollup is now used by default, while support for the NG_BUILD_CHUNKS_ROLLDOWN environment variable has been added to allow opting back into Rolldown for testing and debugging. To make Rolldown truly optional for end users, it has been moved from dependencies to devDependencies, and is now loaded via dynamic import only when requested.
…stics

Enable the advanced chunk optimization pass by default for applications with multiple lazy chunks to improve loading performance. A heuristic is introduced that automatically triggers this optimization when the build generates 3 or more lazy chunks. Developers can customize this behavior or disable it entirely using the NG_BUILD_OPTIMIZE_CHUNKS environment variable. Setting it to a number adjusts the threshold of lazy chunks required to trigger optimization, while setting it to false disables the feature if issues arise in specific projects.
@clydin clydin force-pushed the application/chunk-opt-stable branch from ae4b8c3 to e57e994 Compare April 9, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: @angular/build detected: feature PR contains a feature commit target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants