Single env var STORYKIT_PORT configures backend port, frontend proxy target, frontend dev server port (port + 2172), and WebSocket host. Added .story_kit_port to .gitignore and .ignore to prevent git tracking and cargo watch restart loops. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
27 lines
599 B
TypeScript
27 lines
599 B
TypeScript
import react from "@vitejs/plugin-react";
|
|
import { defineConfig } from "vite";
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig(() => {
|
|
const backendPort = Number(process.env.STORYKIT_PORT || "3001");
|
|
return {
|
|
plugins: [react()],
|
|
define: {
|
|
__STORYKIT_PORT__: JSON.stringify(String(backendPort)),
|
|
},
|
|
server: {
|
|
port: backendPort + 2172,
|
|
proxy: {
|
|
"/api": {
|
|
target: `http://127.0.0.1:${String(backendPort)}`,
|
|
timeout: 120000,
|
|
},
|
|
},
|
|
},
|
|
build: {
|
|
outDir: "dist",
|
|
emptyOutDir: true,
|
|
},
|
|
};
|
|
});
|