diff --git a/scripts/dev.sh b/scripts/dev.sh index dd8fe705..b7835bc1 100755 --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -40,6 +40,10 @@ GOOSE_BIN="${GOOSE_BIN:-}" GOPROXY="${DEV_GOPROXY:-${GOPROXY:-https://goproxy.cn,direct}}" export GOPROXY +# Git Bash 会把以 / 开头的环境变量值误当成 Windows 路径(如 /admin), +# 导致后台路由变成 C:/Program Files/Git/admin;这里仅排除该变量。 +export MSYS2_ENV_CONV_EXCL="${MSYS2_ENV_CONV_EXCL:+${MSYS2_ENV_CONV_EXCL};}VITE_ADMIN_BASE_PATH" + BACKEND_PID="" FRONTEND_PID="" DISTRIBUTION_PID="" @@ -510,6 +514,7 @@ load_env_file() { local line while IFS= read -r line || [[ -n "${line}" ]]; do + line="${line%$'\r'}" [[ -z "${line}" || "${line}" =~ ^[[:space:]]*# ]] && continue line="${line#export }" export "${line}"