File
Blob: vite.config.ts
| 1 | import { cloudflare } from "@cloudflare/vite-plugin"; |
| 2 | import babel from "@rolldown/plugin-babel"; |
| 3 | import tailwindcss from "@tailwindcss/vite"; |
| 4 | import react, { reactCompilerPreset } from "@vitejs/plugin-react"; |
| 5 | import { defineConfig } from "vite"; |
| 6 | |
| 7 | const persistStatePath = process.env.DAB_PERSIST_STATE_PATH; |
| 8 | const wranglerConfigPath = process.env.DAB_WRANGLER_CONFIG_PATH; |
| 9 | |
| 10 | export default defineConfig({ |
| 11 | environments: { |
| 12 | dab: { |
| 13 | build: { |
| 14 | sourcemap: true, |
| 15 | }, |
| 16 | }, |
| 17 | }, |
| 18 | plugins: [ |
| 19 | react(), |
| 20 | babel({ presets: [reactCompilerPreset()] }), |
| 21 | tailwindcss(), |
| 22 | cloudflare({ |
| 23 | ...(wranglerConfigPath ? { configPath: wranglerConfigPath } : {}), |
| 24 | ...(persistStatePath ? { persistState: { path: persistStatePath } } : {}), |
| 25 | remoteBindings: false, |
| 26 | }), |
| 27 | ], |
| 28 | resolve: { |
| 29 | alias: { |
| 30 | "@": new URL("./src", import.meta.url).pathname, |
| 31 | "@tests": new URL("./tests", import.meta.url).pathname, |
| 32 | }, |
| 33 | }, |
| 34 | server: { |
| 35 | cors: false, |
| 36 | }, |
| 37 | }); |