29 lines
1019 B
TypeScript
29 lines
1019 B
TypeScript
import { defineConfig } from "vitest/config";
|
|
import react from "@vitejs/plugin-react";
|
|
import { loadEnv } from "vite";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, fileURLToPath(new URL(".", import.meta.url)), "VITE_");
|
|
return {
|
|
plugins: [react()],
|
|
server: {
|
|
port: 3000,
|
|
// Optional same-origin development bridge for browser acceptance against a real remote API.
|
|
// Production builds never use it and no target is inferred when the variable is absent.
|
|
proxy: env.VITE_API_PROXY_TARGET ? {
|
|
"/api": { target: env.VITE_API_PROXY_TARGET, changeOrigin: false },
|
|
} : undefined,
|
|
},
|
|
test: {
|
|
environment: "jsdom",
|
|
setupFiles: "./src/test/setup.ts",
|
|
// One reusable worker keeps the release gate deterministic on operator
|
|
// hosts that also run several long-lived local control-plane processes.
|
|
pool: "threads",
|
|
maxWorkers: 1,
|
|
isolate: false,
|
|
},
|
|
};
|
|
});
|