Something went wrong. Try again.
I will pick a better name later.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334import { reactRouter } from "@react-router/dev/vite";import tailwindcss from "@tailwindcss/vite";import react from "@vitejs/plugin-react";import { defineConfig } from "vitest/config";
function allowedHostsFromEnv() { const hosts = ["localhost", "127.0.0.1"]; const appUrl = process.env.APP_URL; if (!appUrl) return hosts;
try { hosts.push(new URL(appUrl).hostname); } catch { // Ignore invalid APP_URL here; app runtime validation/docs cover the real value. }
return hosts;}
export default defineConfig(({ mode }) => ({ plugins: mode === "test" ? [react(), tailwindcss()] : [tailwindcss(), reactRouter()], resolve: { tsconfigPaths: true, }, server: { allowedHosts: allowedHostsFromEnv(), }, test: { environment: "jsdom", globals: true, setupFiles: ["./tests/setup.ts"], },}));