import { fileURLToPath, URL } from 'node:url' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import vueDevTools from 'vite-plugin-vue-devtools' // https://vite.dev/config/ export default defineConfig({ plugins: [ vue(), vueDevTools(), ], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) }, }, server: { port: 5173, proxy: { // 管理端接口 -> 直接访问管理端服务 '/admin': { target: 'http://localhost:8088', changeOrigin: true, rewrite: (path) => path }, // 其他微服务接口 -> 通过网关访问 '/api': { target: 'http://localhost:8083', changeOrigin: true, rewrite: (path) => path } } } })