Files
syops/frontend/vite.config.ts
T

28 lines
735 B
TypeScript

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 反代,但本地开发先改这个方便
strictPort: true, // 端口被占用时直接失败,由 start_local.ps1 先释放旧进程
allowedHosts: ['hx.benl.cn'],
proxy: {
'/api': {
target: 'http://127.0.0.1:5052',
changeOrigin: true
}
}
}
})