41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react-swc";
|
|
|
|
import path from "path";
|
|
import dotenv from "dotenv";
|
|
import { fileURLToPath } from "url";
|
|
dotenv.config({
|
|
path: path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../.env"),
|
|
});
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
base: "/lst/app/",
|
|
build: {
|
|
outDir: "../backend/frontend",
|
|
assetsDir: "assets",
|
|
emptyOutDir: true,
|
|
},
|
|
server: {
|
|
proxy: {
|
|
"/lst/api": {
|
|
target: `http://localhost:${Number(
|
|
process.env.VITE_SERVER_PORT || 8080
|
|
)}`,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
},
|
|
"/lst/ws": {
|
|
target: `ws://localhost:${Number(
|
|
process.env.VITE_SERVER_PORT || 8080
|
|
)}`, // Your Go WebSocket endpoint
|
|
ws: true,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
rewrite: (path) => path.replace(/^\/ws/, ""),
|
|
},
|
|
},
|
|
},
|
|
});
|