Repository navigation
perf(@angular/build): avoid duplicate Domino bundling in server bundles - #34527
Merged
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces two new esbuild plugins to ensure Domino is bundled only once for the server. The first plugin exposes the Domino instance on globalThis within the server polyfills bundle, and the second redirects Domino imports in the main server bundle to consume this global instance. Behavior tests have also been added to verify this sharing. The review feedback highlights a potential runtime issue where exporting Domino as a default export in the consumer plugin could break namespace imports, and suggests using CommonJS module.exports to ensure compatibility.
1 task
4 of 13 tasks
Avoid bundling duplicate copies of Domino in both the server polyfills bundle and the main server bundle. The server polyfills bundle exposes the Domino instance attached to globalThis['ɵdomino'] when @angular/platform-server/init is bundled, and the main server bundle redirects Domino imports to this shared instance.
alan-agius4
force-pushed
the
perf-server-domino-dedup
branch
from
October 26, 2026 10:28
7814f94 to
58f0583
Compare
clydin
approved these changes
Oct 26, 2026
Collaborator
Author
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.
PR Checklist
[✓] The commit message follows our guidelines: https://github.com/angular/angular-cli/blob/main/CONTRIBUTING.md#-commit-message-guidelines
[✓] Tests for the changes have been added (for bug fixes / features)
[ ] Docs have been added / updated (for bug fixes / features)
PR Type
[ ] Bugfix
[✓] Feature / Performance
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:
What is the current behavior?
When bundling an application with server-side rendering, Domino (~560 KB unminified) is bundled into both
polyfills.server.mjs(via@angular/platform-server/init) andmain.server.mjs(via@angular/platform-server).What is the new behavior?
Domino is bundled only once in
polyfills.server.mjsand attached toglobalThis['ɵdomino']. The main server bundle redirects Domino imports to this shared instance.This replaces the redundant bundled copy of Domino in
main.server.mjswithout requiring manual filesystem probing oradditionalContentparameter threading in polyfill options.Does this PR introduce a breaking change?
[ ] Yes
[✓] No