-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
41 lines (41 loc) · 1022 Bytes
/
vite.config.ts
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
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import path from 'path';
import eslint from 'vite-plugin-eslint';
// https://vitejs.dev/config/
const TARGET = process.env.PROXY_TARGET || 'http://localhost:3000';
export default defineConfig({
plugins: [react(), eslint()],
resolve: {
alias: {
'~': path.resolve(__dirname, './src/'),
},
},
server: {
port: 8000,
host: true,
open: true,
strictPort: true,
proxy: {
'/trpc': {
target: TARGET,
},
'/ws': {
target: TARGET,
ws: true,
},
'/api/v2': {
target: TARGET,
secure: false,
configure(proxy, options) {
proxy.on('proxyReq', (proxyReq, req, res, options) => {
req.setEncoding('utf8');
proxyReq.setHeader('Host', new URL(TARGET).host);
proxyReq.setHeader('Origin', TARGET);
proxyReq.setHeader('Referer', TARGET);
});
},
},
},
},
});