23 lines
550 B
TypeScript
23 lines
550 B
TypeScript
import { defineConfig, loadEnv } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig(({ mode }) => {
|
|
// 根据当前工作目录中的不同环境变量文件加载环境变量
|
|
const env = loadEnv(mode, process.cwd())
|
|
|
|
return {
|
|
plugins: [vue()],
|
|
server: {
|
|
port: 5173,
|
|
proxy: {
|
|
// 开发环境代理到Go后端
|
|
'/api': {
|
|
target: env.VITE_API_BASE_URL || 'http://127.0.0.1:8100',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
}
|
|
})
|