File size: 968 Bytes
ddac6a2
 
 
 
f044ea5
 
ddac6a2
 
 
 
 
 
 
 
 
 
 
 
fe9f896
f044ea5
 
 
 
 
 
 
 
 
 
 
 
ddac6a2
 
 
fe9f896
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
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
  // 启用详细日志
  logLevel: 'info',
  plugins: [react()],
  server: {
    proxy: {
      '/v1': {
        target: 'https://moelove.info',
        changeOrigin: true,
        secure: false,
        headers: {
          'Access-Control-Allow-Origin': '*'
        }
      },
      '/api': {
        target: 'http://localhost:7860',
        changeOrigin: true,
        configure: (proxy, options) => {
          proxy.on('error', (err, req, res) => {
            console.log('proxy error', err);
          });
          proxy.on('proxyReq', (proxyReq, req, res) => {
            console.log('Sending Request to the Target:', req.method, req.url);
          });
          proxy.on('proxyRes', (proxyRes, req, res) => {
            console.log('Received Response from the Target:', proxyRes.statusCode, req.url);
          });
        }
      }
    }
  }
})