Title: @void/react: client environment has no optimizeDeps.entries for pages, causing a dev re-optimization reload on first load · Issue #599 · voidzero-dev/void · GitHub
Open Graph Title: @void/react: client environment has no optimizeDeps.entries for pages, causing a dev re-optimization reload on first load · Issue #599 · voidzero-dev/void
X Title: @void/react: client environment has no optimizeDeps.entries for pages, causing a dev re-optimization reload on first load · Issue #599 · voidzero-dev/void
Description: Summary In dev, @void/react gives the worker environment a pages/** scan entry but gives the client environment none. Vite's client scanner therefore finds no dependencies, discovers them while serving the first page, re-bundles, and for...
Open Graph Description: Summary In dev, @void/react gives the worker environment a pages/** scan entry but gives the client environment none. Vite's client scanner therefore finds no dependencies, discovers them while ser...
X Description: Summary In dev, @void/react gives the worker environment a pages/** scan entry but gives the client environment none. Vite's client scanner therefore finds no dependencies, discovers them while...
Opengraph URL: https://github.com/voidzero-dev/void/issues/599
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"@void/react: client environment has no optimizeDeps.entries for pages, causing a dev re-optimization reload on first load","articleBody":"## Summary\n\nIn dev, `@void/react` gives the worker environment a `pages/**` scan entry but gives the client environment none. Vite's client scanner therefore finds no dependencies, discovers them while serving the first page, re-bundles, and forces a full page reload (`(client) optimized dependencies changed. reloading`).\n\n- Version: `void` / `@void/react` 1.2.1 (latest). `main` at 65ab6032 has the same code.\n- [`packages/react/src/plugin-pages.ts#L190-L218`](https://github.com/voidzero-dev/void/blob/65ab6032/packages/react/src/plugin-pages.ts#L190-L218): the client env only gets `include: CLIENT_OPTIMIZE_DEPS` (React); `entries: [pagesOptimizeEntries]` is set only under `environments[WORKER_ENVIRONMENT_NAME]` (L214).\n- The worker entry was added in ba979d5c (\"Fix worker crash in dev on initial load\"); its comment explains the worker case only. Nothing in the docs mentions `optimizeDeps`.\n- A second, related gap: the generated client entry imports `void/pages-prefetch` ([L274](https://github.com/voidzero-dev/void/blob/65ab6032/packages/react/src/plugin-pages.ts#L274)). It is a virtual module, so the scanner can't see that import either, and `void/pages-prefetch` is discovered late even when page entries are scanned.\n\n## Repro\n\n1. A Pages app with a few page components that import third-party UI packages (e.g. `@base-ui/react/*`, `@tanstack/react-query`).\n2. `rm -rf node_modules/.vite && DEBUG=vite:deps vp dev`\n3. Open a page in the browser.\n\nObserved (`DEBUG=vite:deps`):\n\n```\n(client) Scan completed in 12.74ms: no dependencies found\nnew dependencies were found while crawling that weren't detected by the scanner\nnew dependencies found: void/pages-prefetch, @base-ui/react/merge-props, ..., motion/react\n(client) optimized dependencies changed. reloading\n```\n\n## Measurements (one app, headless Chromium, cold `node_modules/.vite`, 3 runs per row, numbers summed over the whole load including the reload)\n\n| client config | requests | JS modules | client reload | median time to hydration |\n|---|---|---|---|---|\n| as shipped | 238 / 231 | 233 / 226 | yes (3/3) | 3981 / 4207 ms |\n| + `entries` only | 239 / 233 | 234 / 228 | yes (3/3, only `void/pages-prefetch` late) | 4048 / 4091 ms |\n| + `entries` + `include: ['void/pages-prefetch']` | 217 / 211 | 214 / 208 | no (0/3) | 3453 / 3180 ms |\n\n(two routes per cell)\n\n## Workaround\n\n```ts\n// vite.config.ts\nexport default defineConfig({\n optimizeDeps: {\n entries: ['pages/**/*.{js,jsx,ts,tsx}', '!pages/**/*.server.{js,jsx,ts,tsx}'],\n include: ['void/pages-prefetch'],\n },\n // ...\n});\n```\n\n## Suggested fix\n\nIn the dev `config` hook of `plugin-pages.ts`, also pass the page entries (excluding `*.server.*` companions) to the client `optimizeDeps.entries`, and add `void/pages-prefetch` to the client `include` (it is imported only by the virtual client entry).","author":{"url":"https://github.com/kinwooky","@type":"Person","name":"kinwooky"},"datePublished":"2026-10-26T14:47:48Z","url":"https://github.com/voidzero-dev/void/issues/599"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:795caf96-d968-d8b3-b956-01d33f0d7dc6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B034:1B1794:216CAC:2C36EA:6AFBB44F |
| html-safe-nonce | 0add45ee5839fd88f20d34f486658caa2391c7d0132d59b4e93e126f0ba5d936 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDM0OjFCMTc5NDoyMTZDQUM6MkMzNkVBOjZBRkJCNDRGIiwidmlzaXRvcl9pZCI6Ijg2NTQ5ODg3MDY3ODU3Njg1MjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b0fb5508773ba965f3b147846d70a4098a199cc762007f321b98b5183762258e |
| hovercard-subject-tag | issue:6042049488 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/voidzero-dev/void/599/issue_layout |
| twitter:image | https://opengraph.githubassets.com/282f82bc6d7c4e6fddde8b88070412b4f5fbbfa709b5c4233ff5cd548c3e6138/voidzero-dev/void/issues/599 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/282f82bc6d7c4e6fddde8b88070412b4f5fbbfa709b5c4233ff5cd548c3e6138/voidzero-dev/void/issues/599 |
| og:image:alt | Summary In dev, @void/react gives the worker environment a pages/** scan entry but gives the client environment none. Vite's client scanner therefore finds no dependencies, discovers them while ser... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kinwooky |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2b2ef9c1578c18d8ed27027940544c958743213cf4461659f14d3ccdf51e162c |
| turbo-cache-control | no-preview |
| go-import | github.com/voidzero-dev/void git https://github.com/voidzero-dev/void.git |
| octolytics-dimension-user_id | 149750581 |
| octolytics-dimension-user_login | voidzero-dev |
| octolytics-dimension-repository_id | 1164437080 |
| octolytics-dimension-repository_nwo | voidzero-dev/void |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1164437080 |
| octolytics-dimension-repository_network_root_nwo | voidzero-dev/void |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e4cce0e99cf61481a318ff12c2e8580153a6c7c6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width