import path from 'node:path' import { fileURLToPath } from 'node:url' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' const rootDir = path.dirname(fileURLToPath(import.meta.url)) // https://vite.dev/config/ export default defineConfig({ plugins: [vue()], resolve: { alias: { '@': path.resolve(rootDir, 'src'), }, }, server: { port: 8881, // 前端开发端口,实际上我们会用 Nginx 反代,但本地开发先改这个方便 allowedHosts: ['hx.benl.cn'], proxy: { '/api': { target: 'http://127.0.0.1:5052', changeOrigin: true } } } })