Repository navigation
Commit 6c1a67c
authored
perf(react): scope React DOM prebundles by environment (#532)
React Pages currently pre-includes both React DOM entry points in
browser and Worker dependency optimization. Include `react-dom/client`
in the browser and `react-dom/server` in 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):
| Environment | Before | After |
| --- | ---: | ---: |
| Client | 1,660,390 B | 992,097 B |
| Worker | 1,669,081 B | 756,952 B |
| SSR | 2,705,925 B | 2,705,925 B |
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:
- Focused React plugin tests: 4 passed.
- `vp run test --base origin/main`: 10,750 passed, 31 skipped.
- `vp run check`: all 33 tasks passed.
- Formatting and lint passed for both changed files.
- `vp test run --pool=forks --maxWorkers=4`: 14,048 passed, 31 skipped.1 parent 7967791 commit 6c1a67c
2 files changed
Lines changed: 28 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
24 | 18 | | |
25 | 19 | | |
26 | 20 | | |
| |||
193 | 187 | | |
194 | 188 | | |
195 | 189 | | |
196 | | - | |
| 190 | + | |
197 | 191 | | |
198 | 192 | | |
199 | 193 | | |
200 | | - | |
| 194 | + | |
201 | 195 | | |
202 | 196 | | |
203 | 197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
92 | 115 | | |
93 | 116 | | |
94 | 117 | | |
| |||
0 commit comments