Files
huihuiSquare/digital-avatar-app/vite.config.ts
2026-07-24 14:04:21 +08:00

26 lines
721 B
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 vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
// 后端 API 代理目标(仅 dev / vite 代理生效,生产构建走 nginx 或 __APP_CONFIG__.apiBase
// 默认指向已部署的远端后端 192.168.1.188:8011
// 若在本机另起后端可在启动前覆盖export VITE_API_PROXY_TARGET=http://localhost:8000
const API_PROXY_TARGET = process.env.VITE_API_PROXY_TARGET || 'http://192.168.1.188:8011'
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': resolve(__dirname, 'src')
}
},
server: {
proxy: {
'/api': {
target: API_PROXY_TARGET,
changeOrigin: true
}
}
}
})