import { fileURLToPath, URL } from 'node:url' import BaseUrl from './public/config' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' // https://vitejs.dev/config/ export default defineConfig({ plugins: [ vue(), ], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } }, //设置代理请求 server: { proxy: { '/api': { // 后台地址 target: BaseUrl.URL, changeOrigin: true, rewrite: path => path.replace(/^\/api/, '') } } } })