1import path from "path";
2
3import tailwindcss from "@tailwindcss/vite";
4import { tanstackRouter } from "@tanstack/router-plugin/vite";
5import react from "@vitejs/plugin-react";
6import { defineConfig } from "vite";
7
8// The Go backend URL. Run: git-bug webui --port 3000
9const API_URL = process.env.VITE_API_URL || "http://localhost:3000";
10
11export default defineConfig({
12 plugins: [tanstackRouter({ target: "react", autoCodeSplitting: true }), tailwindcss(), react()],
13 resolve: {
14 alias: {
15 "@": path.resolve(__dirname, "./src"),
16 },
17 },
18 server: {
19 proxy: {
20 "/graphql": { target: API_URL, changeOrigin: true },
21 "/gitfile": { target: API_URL, changeOrigin: true },
22 "/upload": { target: API_URL, changeOrigin: true },
23 "/auth": { target: API_URL, changeOrigin: true },
24 },
25 },
26});