- point MySQL and Whisper settings to the VM - add VM MySQL bootstrap scripts and docs - allow LAN Vite origins for CORS - fix Express 5 validation assignment crash - allow login with username or email - prevent recursive auth refresh retries
57 lines
1.8 KiB
TypeScript
57 lines
1.8 KiB
TypeScript
import { fileURLToPath, URL } from "node:url";
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
import { tanstackRouter } from "@tanstack/router-plugin/vite";
|
|
import viteReact from "@vitejs/plugin-react";
|
|
import { defineConfig, loadEnv } from "vite";
|
|
import tsConfigPaths from "vite-tsconfig-paths";
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const viteEnv = loadEnv(mode, process.cwd(), "");
|
|
const serviceHost = viteEnv.VITE_ORPHION_SERVICE_HOST || "127.0.0.1";
|
|
const apiPort = viteEnv.VITE_API_PORT || "4000";
|
|
const apiProxyTarget = viteEnv.VITE_API_PROXY_TARGET || `http://${serviceHost}:${apiPort}`;
|
|
|
|
return {
|
|
plugins: [
|
|
tanstackRouter({
|
|
target: "react",
|
|
routesDirectory: "./src/routes",
|
|
generatedRouteTree: "./src/routeTree.gen.ts",
|
|
autoCodeSplitting: true,
|
|
}),
|
|
tailwindcss(),
|
|
tsConfigPaths({ projects: ["./tsconfig.json"] }),
|
|
viteReact(),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
|
},
|
|
dedupe: ["react", "react-dom", "@tanstack/react-query", "@tanstack/query-core"],
|
|
},
|
|
server: {
|
|
proxy: {
|
|
"/api": {
|
|
target: apiProxyTarget,
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
build: {
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks(id) {
|
|
if (!id.includes("node_modules")) return undefined;
|
|
if (id.includes("recharts") || id.includes("d3-")) return "charts";
|
|
if (id.includes("framer-motion") || id.includes("motion-")) return "motion";
|
|
if (id.includes("@tanstack")) return "tanstack";
|
|
if (id.includes("@radix-ui")) return "radix";
|
|
if (id.includes("lucide-react")) return "icons";
|
|
return undefined;
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
});
|