Files
Mycontent/soul-admin/vite.config.ts
卡若 6d11fb295d feat: 同步本地三端改动并清理上传凭证风险
整合小程序、管理端与后端的最新本地改动,补齐用户管理与首页入口相关能力;提交前已完成敏感信息扫描,并移除本地 gitea 远程 URL 中的明文凭证,避免隐私信息进入远程仓库。

Made-with: Cursor
2026-04-06 15:59:34 +08:00

36 lines
1.2 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'
import { fileURLToPath } from 'url'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
server: {
port: 5174,
proxy: {
// 与 client 中「DEV 且未设 VITE_API_BASE_URL」配合浏览器只访问 5174由 Vite 转发到 Go
// 注意:前缀 `/api` 会匹配 `/api-docs`,必须把文档页排除,否则请求落到 Go 会 404
'/api': {
target: 'http://127.0.0.1:8080',
changeOrigin: true,
bypass(req) {
const u = req.url ?? ''
if (u === '/api-docs' || u.startsWith('/api-docs?') || u.startsWith('/api-docs/')) {
return false
}
},
},
'/uploads': { target: 'http://127.0.0.1:8080', changeOrigin: true },
// MBTI 等静态资源由 soul-api 的 r.Static("/static", "./static") 提供;开发时同源走 5174 会 404需转发
'/static': { target: 'http://127.0.0.1:8080', changeOrigin: true },
},
},
})