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