import { defineConfig } from 'vite' import Vue from '@vitejs/plugin-vue' export default defineConfig({ plugins: [Vue()], server: { host: '0.0.0.0', port: 19100, open: true, proxy: { '/api': { // 这里的'/api'表示需要转发到的接口路径前缀 target: 'http://127.0.0.1:10010', // 将请求转发到的目标地址 changeOrigin: true, // 支持跨域 rewrite: (path) => path.replace(/^\/api/, '') // 去除请求路径中的'/api'前缀 } } }, })