forked from ace-step/ACE-Step-DAW
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
33 lines (30 loc) · 972 Bytes
/
vite.config.ts
File metadata and controls
33 lines (30 loc) · 972 Bytes
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
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import tailwindcss from '@tailwindcss/vite';
const apiTarget = process.env.VITE_API_TARGET || 'http://127.0.0.1:8001';
const serverPort = Number(process.env.VITE_PORT) || 5174;
export default defineConfig({
plugins: [react(), tailwindcss()],
server: {
host: '127.0.0.1',
port: serverPort,
strictPort: true,
proxy: {
'/api': {
target: apiTarget,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
timeout: 5 * 60 * 1000,
proxyTimeout: 5 * 60 * 1000,
configure: (proxy) => {
proxy.on('error', (_err, _req, res) => {
if (res && 'writeHead' in res && !res.headersSent) {
res.writeHead(502, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ error: 'Backend unavailable' }));
}
});
},
},
},
},
});