~bigbes/lethe

ref: 1be25bac49ceac3bb2923ce40facdf9ba7a9811f lethe/web/vite.config.ts -rw-r--r-- 1.8 KiB
1be25bac — Eugene Blikh docs: record shipped web tasks and dev tooling updates 24 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { TanStackRouterVite } from '@tanstack/router-plugin/vite'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    TanStackRouterVite({ routesDirectory: './src/routes', generatedRouteTree: './src/routeTree.gen.ts' }),
    react(),
  ],
  server: {
    proxy: {
      '/api/v1': {
        target: 'http://127.0.0.1:18888',
        changeOrigin: true,
        configure: (proxy) => {
          proxy.on('proxyReq', (req) => {
            req.setHeader('Remote-User', 'bigbes')
          })
        },
      },
      '/healthz': {
        target: 'http://127.0.0.1:18888',
        changeOrigin: true,
        configure: (proxy) => {
          proxy.on('proxyReq', (req) => {
            req.setHeader('Remote-User', 'bigbes')
          })
        },
      },
      '/readyz': {
        target: 'http://127.0.0.1:18888',
        changeOrigin: true,
        configure: (proxy) => {
          proxy.on('proxyReq', (req) => {
            req.setHeader('Remote-User', 'bigbes')
          })
        },
      },
      '/metrics': {
        target: 'http://127.0.0.1:18888',
        changeOrigin: true,
        configure: (proxy) => {
          proxy.on('proxyReq', (req) => {
            req.setHeader('Remote-User', 'bigbes')
          })
        },
      },
    },
  },
  build: {
    // DEVIATION: output goes directly into the Go embed directory so no copy step is needed in CI
    outDir: '../internal/server/web/dist',
    // emptyOutDir: false preserves the committed .gitkeep and placeholder
    // index.html so `go build` works on a fresh clone. Vite's hashed asset
    // filenames prevent stale chunk accumulation; use `just web-clean` for a
    // full reset when needed.
    emptyOutDir: false,
  },
})