Repository navigation
Commit 7eb2144
fix(react): serve a workspace-linked void as source in dev (#720)
## What changed
Locally, React Pages apps in this repo could stop hydrating after `vp
run build`. The browser threw:
```
SyntaxError: The requested module '/node_modules/.vite/deps/void_pages-client.js?v=…'
does not provide an export named 'isVoidActionError'
```
The client entry never loaded, so `#app` was never marked hydrated.
`websockets-playground.test.ts` timed out on `/chat` and
`/notifications` (noted in #719). CI passed because it starts with no
Vite cache.
### Cause
In dev, the React adapter listed `void/pages-client` and
`void/pages-prefetch` in the client `optimizeDeps.include` (#620). It
listed `void/live/client` in the worker include. Here `void` is a linked
workspace package. Vite serves a linked package as source unless it is
listed in `include`, and a listed one is pre-bundled into
`node_modules/.vite`. That cache is keyed by the lockfile, config and
`NODE_ENV`, not by the linked package's files, so rebuilding Void left
the old copy in place.
#715 added `isVoidActionError` to `void/pages-client` and re-exported it
from `@void/react`. Any cache written before #715 then broke the client.
### Fix
`installedDependencies()` keeps a Void entry in `include` only when it
resolves into `node_modules`:
| `void` install | Before | After |
| --- | --- | --- |
| From the registry (`node_modules`) | pre-bundled | pre-bundled (keeps
#620's cold-start fix) |
| Linked workspace package | pre-bundled, stale after a rebuild | served
as source, always the current build |
This only changes dev behavior for linked installs. Apps that install
`void` from npm see no difference.
## For reviewers
- **Served as source:** in a linked install, these entries pull in only
`@void/edge`, which is linked too and has no imports. Serving them as
source therefore can't trigger a late dependency discovery or a full
reload.
- **`void/live/client`:** the worker include had the same stale-copy
hazard, so the same rule applies there.
- **Resolution:** `import.meta.resolve` from `@void/react`. `void` is a
peer dependency, so this finds the same `void` the app uses.
## Verification
- Replayed the failure: built `void` at #715's parent and ran the
websockets suite to fill the cache. Then I rebuilt on this branch and
ran it again. Before this change: 2 failed. After: 3/3 passed on two
runs.
- `packages/react/test/unit/plugin-pages.test.ts`: 34 passed. A new unit
test covers installed paths (pnpm, npm, Windows) and a linked path. The
dev-config test now checks that this workspace's linked `void` is not
pre-bundled.
- `vp run check`, lint and format are clean.
- Full `vp test run`: 774 of 777 files passed (1 skipped). The other 2
files were the Vue and Svelte `*-pages-client` preview suites. They
reuse an existing playground `dist`, and this worktree's predated their
newest fixtures. After deleting those `dist` folders, both passed (94
tests).
To clear a stale cache without this change:
```sh
rm -rf playground/<app>/node_modules/.vite
```
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 2680b99 commit 7eb2144
2 files changed
Lines changed: 56 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
76 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
77 | 82 | | |
78 | 83 | | |
79 | 84 | | |
| |||
89 | 94 | | |
90 | 95 | | |
91 | 96 | | |
92 | | - | |
| 97 | + | |
93 | 98 | | |
94 | 99 | | |
95 | 100 | | |
| |||
117 | 122 | | |
118 | 123 | | |
119 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
120 | 141 | | |
121 | 142 | | |
122 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
200 | 216 | | |
201 | 217 | | |
202 | 218 | | |
| |||
209 | 225 | | |
210 | 226 | | |
211 | 227 | | |
212 | | - | |
| 228 | + | |
213 | 229 | | |
214 | 230 | | |
215 | 231 | | |
216 | 232 | | |
217 | 233 | | |
218 | 234 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
| 235 | + | |
225 | 236 | | |
226 | 237 | | |
227 | 238 | | |
| |||
287 | 298 | | |
288 | 299 | | |
289 | 300 | | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
290 | 314 | | |
291 | 315 | | |
292 | 316 | | |
| |||
0 commit comments