Files
asset_helper/frontend/vite.config.ts
fish 83d9a08b97 打通前后端联调链路
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-26 15:15:19 +08:00

33 lines
688 B
TypeScript

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'
export default defineConfig(({ mode }) => ({
plugins: [react()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
server: {
host: '0.0.0.0',
port: 5173,
strictPort: true,
watch: {
usePolling: true,
},
proxy: {
'/api': {
// 开发环境:通过 Docker 网络直接访问网关容器
target: process.env.VITE_API_BASE_URL || 'http://api-gateway',
changeOrigin: true,
secure: false,
},
},
},
build: {
outDir: 'dist',
sourcemap: mode !== 'production',
},
}))