Files
lst/frontend/vite.config.ts

67 lines
1.8 KiB
TypeScript

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import { tanstackRouter } from "@tanstack/router-plugin/vite";
import tailwindcss from "@tailwindcss/vite";
import path from "path";
import dotenv from "dotenv";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
dotenv.config({
path: path.resolve(__dirname, "../.env"),
});
// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
tailwindcss(),
tanstackRouter({
target: "react",
autoCodeSplitting: true,
}),
],
base: "/lst/app",
build: {
//outDir: "../backend/frontend",
//assetsDir: "assets",
emptyOutDir: true,
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
server: {
port: 5500,
host: true,
allowedHosts: true,
proxy: {
"/lst/api": {
target: `http://localhost:${Number(
process.env.VITE_PORT || 4000
)}`,
changeOrigin: true,
secure: false,
},
"/lst/ws": {
target: `ws://localhost:${Number(
process.env.VITE_PORT || 4000
)}`, // Your Go WebSocket endpoint
ws: true,
changeOrigin: true,
secure: false,
rewrite: (path) => path.replace(/^\/ws/, ""),
},
// Proxy docs to Docusaurus
"/lst/d": {
target: `http://localhost:4300`,
changeOrigin: true,
//rewrite: (path) => path.replace(/^\/lst\/d/, "/"),
},
},
},
});