import { cloudflare } from "@cloudflare/vite-plugin"; import babel from "@rolldown/plugin-babel"; import tailwindcss from "@tailwindcss/vite"; import react, { reactCompilerPreset } from "@vitejs/plugin-react"; import { defineConfig } from "vite"; const persistStatePath = process.env.DAB_PERSIST_STATE_PATH; const wranglerConfigPath = process.env.DAB_WRANGLER_CONFIG_PATH; export default defineConfig({ environments: { dab: { build: { sourcemap: true, }, }, }, plugins: [ react(), babel({ presets: [reactCompilerPreset()] }), tailwindcss(), cloudflare({ ...(wranglerConfigPath ? { configPath: wranglerConfigPath } : {}), ...(persistStatePath ? { persistState: { path: persistStatePath } } : {}), remoteBindings: false, }), ], resolve: { alias: { "@": new URL("./src", import.meta.url).pathname, "@tests": new URL("./tests", import.meta.url).pathname, }, }, server: { cors: false, }, });