28 lines · 1.1 KBRaw
| 1 | import { cloudflare } from "@cloudflare/vite-plugin"; |
| 2 | import { reactRouter } from "@react-router/dev/vite"; |
| 3 | import tailwindcss from "@tailwindcss/vite"; |
| 4 | import { defineConfig } from "vite"; |
| 5 | |
| 6 | /** |
| 7 | * `REFS_REMOTE=1` runs local dev against production data: D1 and the OAuth KV become remote bindings. Pushes and |
| 8 | * email stay local, so dev never feeds the production queue or sends mail. Everything else you do is real. |
| 9 | */ |
| 10 | const remote = process.env.REFS_REMOTE === "1"; |
| 11 | |
| 12 | export default defineConfig({ |
| 13 | plugins: [ |
| 14 | cloudflare({ |
| 15 | viteEnvironment: { name: "ssr" }, |
| 16 | config: remote |
| 17 | ? (config) => { |
| 18 | config.d1_databases = [{ binding: "DB", database_name: "refs", database_id: "4ea63a47-23af-48d9-8bac-5d9159eaf2fa", migrations_dir: "migrations", remote: true }]; |
| 19 | config.kv_namespaces = [{ binding: "OAUTH_KV", id: "7bb4a2982fd443b7a4cb685b416428bb", remote: true }]; |
| 20 | } |
| 21 | : undefined, |
| 22 | }), |
| 23 | tailwindcss(), |
| 24 | reactRouter(), |
| 25 | ], |
| 26 | server: { port: 8787 }, |
| 27 | optimizeDeps: { include: ["@base-ui/react/*", "lucide-react", "react-router", "react", "react-dom", "react-dom/client"] }, |
| 28 | }); |