vite.config.ts

 1import path from "path";
 2
 3import react from "@vitejs/plugin-react";
 4import { defineConfig } from "vite";
 5
 6// The Go backend URL. Run: git-bug webui --port 3000
 7const API_URL = process.env.VITE_API_URL || "http://localhost:3000";
 8
 9export default defineConfig({
10  plugins: [react()],
11  resolve: {
12    alias: {
13      "@": path.resolve(__dirname, "./src"),
14    },
15  },
16  build: {
17    // highlight.js is inherently large (~1MB) but lazy-loaded; silence the warning.
18    chunkSizeWarningLimit: 1100,
19    rollupOptions: {
20      output: {
21        manualChunks: {
22          "vendor-react": ["react", "react-dom", "react-router-dom"],
23          "vendor-apollo": ["@apollo/client", "graphql"],
24          "vendor-markdown": ["react-markdown", "remark-gfm"],
25          "vendor-highlight": ["highlight.js"],
26        },
27      },
28    },
29  },
30  server: {
31    proxy: {
32      "/graphql": { target: API_URL, changeOrigin: true },
33      "/gitfile": { target: API_URL, changeOrigin: true },
34      "/upload": { target: API_URL, changeOrigin: true },
35      "/auth": { target: API_URL, changeOrigin: true },
36    },
37  },
38});