| 1 | import react from "@vitejs/plugin-react"; |
| 2 | import rsc from "@vitejs/plugin-rsc"; |
| 3 | import { defineConfig } from "vite"; |
| 4 | |
| 5 | // Minimal React Router app (hand-rolled on @vitejs/plugin-rsc). The Worker IS |
| 6 | // the `rsc` environment; its fetch handler loads the `ssr` environment at |
| 7 | // runtime via `import.meta.viteRsc.loadModule("ssr", ...)`. The Cloudflare |
| 8 | // plugin configuration, including the `viteEnvironments` option that declares |
| 9 | // this entry/child topology, lives in `e2e.config.ts`. |
| 10 | export default defineConfig({ |
| 11 | plugins: [ |
| 12 | react(), |
| 13 | rsc({ |
| 14 | serverHandler: false, |
| 15 | entries: { |
| 16 | client: "./react-router-vite/entry.browser.tsx", |
| 17 | ssr: "./react-router-vite/entry.ssr.tsx", |
| 18 | rsc: "./react-router-vite/entry.worker.tsx", |
| 19 | }, |
| 20 | }), |
| 21 | ], |
| 22 | optimizeDeps: { |
| 23 | include: ["react-router", "react-router/internal/react-server-client"], |
| 24 | }, |
| 25 | }); |