33 lines
688 B
TypeScript
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',
|
|
},
|
|
}))
|