31 lines
875 B
TypeScript
31 lines
875 B
TypeScript
import config from "./lib/config";
|
|
import { defineConfig } from "vite";
|
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
import react from "@vitejs/plugin-react";
|
|
|
|
const { CAIRO_VITE_BACKEND_URL, CAIRO_VITE_DEV_PORT } = process.env;
|
|
const backendUrl = CAIRO_VITE_BACKEND_URL ?? "http://localhost:52000";
|
|
const vitePort = Number(CAIRO_VITE_DEV_PORT) ?? 52025;
|
|
export default () => {
|
|
return defineConfig({
|
|
plugins: [react(), tsconfigPaths()],
|
|
server: {
|
|
host: "0.0.0.0",
|
|
port: vitePort,
|
|
proxy: {
|
|
"/api": backendUrl,
|
|
"/healthz": backendUrl,
|
|
},
|
|
hmr: {
|
|
protocol: process.env.CAIRO_VITE_DEV_PROTOCOL,
|
|
},
|
|
},
|
|
build: {
|
|
outDir: "./build/vite",
|
|
},
|
|
base: config.Server.basePath,
|
|
define: {
|
|
"import.meta.env.VITE_CAIRO_PROJECT": JSON.stringify(config.Server.projectSlug),
|
|
},
|
|
});
|
|
};
|