Vite optimizeDeps race condition causes createRoot not found in dev mode.
After pnpm dev, React island hydration fails:
[astro-island] Error hydrating /src/components/Counter.tsx
SyntaxError: The requested module 'react-dom/client.js'
does not provide an export named 'createRoot'
pnpm build → node dist/server/entry.mjs is NOT affected.
git clean -fdx
pnpm i
pnpm dev
# Open http://localhost:4321/ in browser
# Console shows createRoot errorThe built-in plugin astro:integration-container has a buildStart hook without applyToEnvironment filter, causing it to run in the client environment. The SSR-only route.js (from Actions onRequest) gets registered in the client depsOptimizer before React's optimizeDeps.include is processed. Vite's initial optimization produces only 1 entry (route.js), skipping react-dom/client. The browser receives the raw CJS file and cannot resolve the named export.
See GitHub #16387 for details.
Four conditions are required: adapter + React + Actions + React island. But these four alone don't trigger the bug — Vite starts fast enough that optimizeDeps.include is processed before buildStart.
@inlang/paraglide-js (compiles inlang project at startup) and @tailwindcss/vite (Vite plugin pipeline) combined add enough startup overhead to shift the timing, causing buildStart to execute before optimizeDeps.include. Neither alone is sufficient.
- Astro 6.3.3 / @astrojs/react 5.0.5 / Vite 7.3.3
- @inlang/paraglide-js 2.18.0 / @tailwindcss/vite 4.3.0
- React 19.2.6 / Node 24