Repository navigation
perf(react): scope React DOM prebundles by environment - #532
Merged
Merged
Conversation
Keep react-dom/server out of the browser prebundle and react-dom/client out of the Worker prebundle. Preserve the existing SSR prebundle list; disabling the unused Cloudflare SSR optimizer is covered by perf/skip-ssr-prebundle.
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.
React Pages currently pre-includes both React DOM entry points in browser and Worker dependency optimization. Include
react-dom/clientin the browser andreact-dom/serverin the Worker, with regression coverage for those scopes and the existing SSR includes.An installed-package comparison on a two-page React app reduced generated prebundle JavaScript by 1,580,422 bytes (source maps and metadata excluded):
The 80-sample benchmark used 20 randomized baseline/branch pairs for each cold/warm cache state, with fresh dev processes and browser contexts. Every sample passed hydration, interaction, and client-navigation checks. Browser transfer was effectively unchanged, and neither cold nor warm process-to-hydration time showed a statistically significant improvement (adjusted p = 0.751 and 0.800). This supports a smaller generated cache; it does not establish a startup speedup. Timings came from a small React fixture with background host activity.
Validation:
vp run test --base origin/main: 10,750 passed, 31 skipped.vp run check: all 33 tasks passed.vp test run --pool=forks --maxWorkers=4: 14,048 passed, 31 skipped.