Files
video/admin/vite.config.js
2026-10-15 20:36:59 +08:00

30 lines
757 B
JavaScript
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 { fileURLToPath, URL } from 'node:url'
import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite'
// 开发环境:/api 反向代理到本地 FastAPI(http://localhost:8000)
// 生产环境:由 nginx 托管构建产物,并将 /api 反代到后端
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
server: {
port: 5173,
proxy: {
'/api': {
target: 'http://localhost:8000',
changeOrigin: true,
},
// 本地文件存储(头像/封面):/static → 后端 uploads 目录
'/static': {
target: 'http://localhost:8000',
changeOrigin: true,
},
},
},
})