| 1 | import { defineConfig } from "vite"; |
| 2 | |
| 3 | // `Cloudflare.Worker({ vite })` declares an `ssr` environment but doesn't set |
| 4 | // a worker entry by default. For non-framework projects (no React/Vue plugin |
| 5 | // to inject one), Vite errors out with "rollupOptions.input should not be an |
| 6 | // html file when building for SSR". Point the SSR build at the worker entry so |
| 7 | // the cloudflare-vite-plugin can wrap it into the worker bundle. |
| 8 | export default defineConfig({ |
| 9 | environments: { |
| 10 | ssr: { |
| 11 | build: { |
| 12 | rollupOptions: { |
| 13 | input: "./src/worker.ts", |
| 14 | }, |
| 15 | }, |
| 16 | }, |
| 17 | }, |
| 18 | }); |