修改常见默认端口
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
# 复制为 frontend/.env 后生效(Vite 仅暴露 VITE_ 前缀变量)
|
||||
|
||||
# 开发服务器端口(也可由根目录 FRONTEND_PORT 通过 start.sh 传入)
|
||||
# PORT=5173
|
||||
# PORT=15173
|
||||
|
||||
# 后端 API 代理目标(见 vite.config.ts)
|
||||
VITE_API_PROXY_TARGET=http://localhost:8080
|
||||
VITE_API_PROXY_TARGET=http://localhost:18080
|
||||
|
||||
@@ -15,8 +15,8 @@ const { Paragraph, Text } = Typography
|
||||
|
||||
const baseUrl =
|
||||
typeof window !== 'undefined'
|
||||
? window.location.origin.replace(':5173', ':8080')
|
||||
: 'http://localhost:8080'
|
||||
? window.location.origin.replace(':15173', ':18080')
|
||||
: 'http://localhost:18080'
|
||||
|
||||
const deliveryModes = [
|
||||
{
|
||||
|
||||
@@ -4,8 +4,8 @@ import react from '@vitejs/plugin-react'
|
||||
export default defineConfig(({ mode }) => {
|
||||
// 读取 frontend/.env* 与进程环境(start.sh 会注入根目录 .env)
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
const apiTarget = env.VITE_API_PROXY_TARGET || 'http://localhost:8080'
|
||||
const port = Number(env.PORT || env.FRONTEND_PORT || 5173)
|
||||
const apiTarget = env.VITE_API_PROXY_TARGET || 'http://localhost:18080'
|
||||
const port = Number(env.PORT || env.FRONTEND_PORT || 15173)
|
||||
|
||||
return {
|
||||
plugins: [react()],
|
||||
|
||||
Reference in New Issue
Block a user