Sanakey
3 天以前 b5c1614fe473330ceca8b7cff0f1802e19bd5039
提交 | 用户 | age
5e9946 1 import { defineApplicationConfig } from '@vben/vite-config';
3576d0 2
5e9946 3 export default defineApplicationConfig({
V 4   overrides: {
feadf6 5     optimizeDeps: {
V 6       include: [
7         'echarts/core',
8         'echarts/charts',
9         'echarts/components',
10         'echarts/renderers',
11         'qrcode',
12         '@iconify/iconify',
13         'ant-design-vue/es/locale/zh_CN',
14         'ant-design-vue/es/locale/en_US',
15       ],
16     },
99ac30 17     server: {
128809 18       
5e9946 19       proxy: {
V 20         '/basic-api': {
128809 21           target: 'http://yingchen.onbus.cn:9010',
5e9946 22           changeOrigin: true,
V 23           ws: true,
24           rewrite: (path) => path.replace(new RegExp(`^/basic-api`), ''),
128809 25           bypass(req, res, options: any) {
H 26             const proxyURL = options.target + options.rewrite(req.url);
27             console.log("客户端请求的真正地址:", proxyURL);
28             res.setHeader("REAL-URL", proxyURL); // 设置响应头在浏览器中可见
29           }
5e9946 30           // only https
V 31           // secure: false
32         },
33         '/upload': {
34           target: 'http://localhost:3300/upload',
35           changeOrigin: true,
36           ws: true,
37           rewrite: (path) => path.replace(new RegExp(`^/upload`), ''),
116a1f 38         },
128809 39
bd7b53 40       },
9372f1 41       open: true, // 项目启动后,自动打开
e6c7b5 42       warmup: {
X 43         clientFiles: ['./index.html', './src/{views,components}/*'],
128809 44       }
bd7b53 45     },
5e9946 46   },
V 47 });