Files
hometown/start-front.sh
2026-03-07 23:47:29 +08:00

15 lines
548 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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}"