2025-10-23 09:54:45 +00:00
|
|
|
/// <reference types="vite/client" />
|
|
|
|
|
|
2025-10-24 15:06:42 +00:00
|
|
|
import { cloudflare } from "@cloudflare/vite-plugin";
|
2025-10-23 09:54:45 +00:00
|
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
|
|
|
import react from "@vitejs/plugin-react";
|
2025-10-24 15:06:42 +00:00
|
|
|
import { defineConfig, PluginOption } from "vite";
|
2025-10-23 09:54:45 +00:00
|
|
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
|
|
|
|
|
|
|
|
// https://vitejs.dev/config/
|
2025-10-24 15:06:42 +00:00
|
|
|
export default defineConfig(({ mode }) => {
|
|
|
|
|
const plugins: PluginOption[] = [
|
|
|
|
|
react(),
|
|
|
|
|
// visualizer() as PluginOption,
|
|
|
|
|
tailwindcss(),
|
2026-04-15 13:52:53 +00:00
|
|
|
tsconfigPaths({ ignoreConfigErrors: true }),
|
2025-10-24 15:06:42 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// Only include cloudflare plugin when not in test mode
|
|
|
|
|
if (mode !== "test" && process.env.VITEST !== "true") {
|
2026-04-15 13:52:53 +00:00
|
|
|
plugins.push(cloudflare({ inspectorPort: 9231 }));
|
2025-10-24 15:06:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
plugins,
|
2026-04-22 20:13:30 +00:00
|
|
|
build: {
|
|
|
|
|
sourcemap: mode === "test" ? false : "hidden",
|
|
|
|
|
},
|
2025-10-24 15:06:42 +00:00
|
|
|
server: {
|
|
|
|
|
cors: false,
|
|
|
|
|
},
|
|
|
|
|
define: process.env.VITEST
|
|
|
|
|
? {
|
|
|
|
|
"import.meta.env.VITE_SUPABASE_URL": JSON.stringify("https://test.supabase.co"),
|
|
|
|
|
"import.meta.env.VITE_SUPABASE_ANON_KEY": JSON.stringify("test-anon-key"),
|
|
|
|
|
}
|
|
|
|
|
: undefined,
|
|
|
|
|
test: {
|
|
|
|
|
globals: true,
|
|
|
|
|
environment: "jsdom",
|
|
|
|
|
setupFiles: "./src/setupTests.ts",
|
2025-10-23 09:54:45 +00:00
|
|
|
},
|
2025-10-24 15:06:42 +00:00
|
|
|
};
|
2025-10-23 09:54:45 +00:00
|
|
|
});
|