| 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
 | | import { defineConfig, loadEnv } from 'vite'; |  | import react from '@vitejs/plugin-react'; |  | import { resolve } from 'path'; |  |   |  | // https://vitejs.dev/config/ |  | export default defineConfig(({ mode }) => { |  |   const env = loadEnv(mode, process.cwd()); |  |   return { |  |     plugins: [react()], |  |     resolve: { |  |       alias: { |  |         '@/': resolve('src') + '/', |  |       }, |  |     }, |  |     server: { |  |       port: 8122, |  |       host: '0.0.0.0', |  |       open: true, |  |       // available in run dev |  |       proxy: { |  |         '/rsf-server': { |  |           target: `http://${env.VITE_BASE_IP}:${env.VITE_BASE_PORT}`, |  |           changeOrigin: true, |  |           bypass: (req, res, options) => { |  |             const proxyUrl = `${options.target}${req.url}`; |  |             res.setHeader('x-rel-url', proxyUrl); |  |           } |  |           // rewrite: (path) => path.replace(/^\/api/, ''), |  |         }, |  |         '/ws': { |  |           target: `ws://${env.VITE_BASE_IP}:${env.VITE_BASE_PORT}`, |  |           changeOrigin: true, |  |           ws: true, |  |         }, |  |       }, |  |     }, |  |     base: './', |  |     envPrefix: 'VITE_', |  |     open: true, |  |     cors: true, |  |   }; |  | }); | 
 |