garage-webui/vite.config.ts
2024-08-23 05:14:45 +07:00

30 lines
660 B
TypeScript

import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react-swc";
import path from "path";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
return {
plugins: [react()],
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
},
},
server: {
proxy: {
"/api": {
target: process.env.VITE_API_URL,
changeOrigin: true,
},
"/ws": {
target: process.env.VITE_API_URL?.replace("http", "ws"),
ws: true,
},
},
},
};
});