import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import { fileURLToPath, URL } from 'node:url' /** * 开发时前端跑在 5173,后端跑在 7580,接口请求转发过去。 * 打包后前端是纯静态文件,由后端一起提供,不存在跨域问题。 */ export default defineConfig({ root: 'web', plugins: [vue()], resolve: { alias: { '~': fileURLToPath(new URL('./web', import.meta.url)), '@shared': fileURLToPath(new URL('./shared', import.meta.url)), }, }, server: { port: 5173, proxy: { '/api': { target: 'http://127.0.0.1:7580', changeOrigin: false, }, }, }, build: { outDir: '../web-dist', emptyOutDir: true, }, })