latest code
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
import { defineConfig, loadEnv } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import path from "path";
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
|
||||
const env = loadEnv(mode, process.cwd(), "");
|
||||
|
||||
const apiUrl = env.VITE_API_BASE_URL || "http://localhost:20001/api";
|
||||
const apiTarget = apiUrl.replace(/\/api\/?$/, "");
|
||||
const wsTarget = apiTarget.replace(/^http/, "ws");
|
||||
|
||||
return {
|
||||
|
||||
plugins: [react()],
|
||||
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve(__dirname, "./src"),
|
||||
},
|
||||
},
|
||||
|
||||
optimizeDeps: {
|
||||
exclude: ["lucide-react"],
|
||||
},
|
||||
|
||||
server: {
|
||||
port: 5174,
|
||||
allowedHosts: true,
|
||||
|
||||
proxy: {
|
||||
/*
|
||||
--------------------------------
|
||||
YOUR APPLICATION BACKEND
|
||||
--------------------------------
|
||||
*/
|
||||
|
||||
"/api/saas": {
|
||||
target: env.VITE_SAAS_API_URL || "http://localhost:8000",
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api\/saas/, "/api"),
|
||||
},
|
||||
|
||||
"/api": {
|
||||
target: apiTarget,
|
||||
changeOrigin: true,
|
||||
},
|
||||
|
||||
"/socket.io": {
|
||||
target: apiTarget,
|
||||
ws: true,
|
||||
changeOrigin: true,
|
||||
},
|
||||
|
||||
"/socket": {
|
||||
target: wsTarget,
|
||||
ws: true,
|
||||
changeOrigin: true,
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
build: {
|
||||
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: {
|
||||
|
||||
"vendor-react": ["react", "react-dom", "react-router-dom"],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
chunkSizeWarningLimit: 900,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user