Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

vite.config.ts

30 lines749 Bytes

1import { defineConfig } from 'vite'
2import react from '@vitejs/plugin-react'
3import tailwindcss from '@tailwindcss/vite'
4​
5const backendProxies = [
6 { id: 'go', port: 8001 },
7 { id: 'rust', port: 8002 },
8 { id: 'php', port: 8003 },
9 { id: 'zig', port: 8004 },
10 { id: 'bash', port: 8005 },
11 { id: 'python', port: 8006 },
12] as const
13​
14export default defineConfig({
15 plugins: [react(), tailwindcss()],
16 server: {
17 port: 3000,
18 proxy: Object.fromEntries(
19 backendProxies.map(({ id, port }) => [
20 `/api/${id}`,
21 {
22 target: `http://127.0.0.1:${port}`,
23 changeOrigin: true,
24 rewrite: (path) =>
25 path.replace(new RegExp(`^/api/${id}/?$`), '/') || '/',
26 },
27 ]),
28 ),
29 },
30})