fix:优化启动配置

This commit is contained in:
Daniel
2026-03-07 23:47:29 +08:00
parent c3d219efc1
commit 7db497bc94
6 changed files with 219 additions and 4 deletions

14
start-front.sh Normal file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# 构建前端并启动静态服务预览(前后端分离时前端预览)
# 在项目根目录执行: ./start-front.sh 或 FRONT_PORT=8080 ./start-front.sh
# 需在 api.config.json 中配置 apiBase 指向后端地址
set -e
cd "$(dirname "$0")"
FRONT_PORT="${FRONT_PORT:-8990}"
echo "[720yun-offline] 构建前端到 dist/..."
npm run build
echo "[720yun-offline] 启动静态预览 http://0.0.0.0:${FRONT_PORT}仅前端API 需单独启动并配置 api.config.json"
exec npx --yes serve dist -l "${FRONT_PORT}"