Files
huskies/frontend/vite.config.ts
T

52 lines
1.3 KiB
TypeScript
Raw Normal View History

import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
// https://vite.dev/config/
2026-02-19 17:14:33 +00:00
export default defineConfig(() => {
const backendPort = Number(process.env.STORYKIT_PORT || "3001");
2026-02-19 17:14:33 +00:00
return {
plugins: [react()],
define: {
__STORYKIT_PORT__: JSON.stringify(String(backendPort)),
__BUILD_TIME__: JSON.stringify(new Date().toISOString()),
},
2026-02-19 17:14:33 +00:00
server: {
port: backendPort + 2172,
2026-02-19 17:14:33 +00:00
proxy: {
"/api": {
target: `http://127.0.0.1:${String(backendPort)}`,
2026-02-19 17:14:33 +00:00
timeout: 120000,
configure: (proxy) => {
proxy.on("error", (_err) => {
// Swallow proxy errors (e.g. ECONNREFUSED during backend restart)
// so the vite dev server doesn't crash.
});
},
2026-02-19 17:14:33 +00:00
},
2026-03-18 15:50:20 +00:00
"/agents": {
target: `http://127.0.0.1:${String(backendPort)}`,
timeout: 120000,
configure: (proxy) => {
proxy.on("error", (_err) => {});
},
},
2026-02-19 14:45:57 +00:00
},
watch: {
ignored: [
"**/.story_kit/**",
"**/target/**",
"**/.git/**",
"**/server/**",
"**/Cargo.*",
"**/vendor/**",
"**/node_modules/**",
],
},
2026-02-16 18:57:39 +00:00
},
2026-02-19 17:14:33 +00:00
build: {
outDir: "dist",
emptyOutDir: true,
},
};
});