chore: use different base url for different output
This commit is contained in:
2
.env.production
Normal file
2
.env.production
Normal file
@@ -0,0 +1,2 @@
|
||||
# 生产环境配置
|
||||
VITE_API_BASE_URL=http://47.109.95.59:20080
|
||||
@@ -1,7 +1,7 @@
|
||||
// API 配置
|
||||
|
||||
export const API_CONFIG = {
|
||||
BASE_URL: 'http://127.0.0.1:8099',
|
||||
BASE_URL: import.meta.env.VITE_API_BASE_URL || 'http://127.0.0.1:8099',
|
||||
TIMEOUT: 10000,
|
||||
HEADERS: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
@@ -4,4 +4,7 @@ import react from '@vitejs/plugin-react'
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
// Vite 默认支持环境变量,无需额外配置
|
||||
// 环境变量加载优先级:
|
||||
// .env.local > .env.[mode] > .env
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user