37 lines
892 B
TypeScript
37 lines
892 B
TypeScript
import { defineConfig, loadEnv } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
import { TanStackRouterVite } from "@tanstack/router-plugin/vite";
|
|
import path from "node:path";
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd(), "");
|
|
const apiTarget = env.VITE_API_PROXY_TARGET ?? "http://localhost:8443";
|
|
|
|
return {
|
|
plugins: [
|
|
TanStackRouterVite({ target: "react", autoCodeSplitting: true }),
|
|
react(),
|
|
tailwindcss(),
|
|
],
|
|
resolve: {
|
|
alias: { "@": path.resolve(__dirname, "./src") },
|
|
},
|
|
server: {
|
|
host: "0.0.0.0",
|
|
port: 5173,
|
|
proxy: {
|
|
"/api": {
|
|
target: apiTarget,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
},
|
|
},
|
|
},
|
|
build: {
|
|
target: "es2022",
|
|
sourcemap: true,
|
|
},
|
|
};
|
|
});
|