refactor(node-heap): raise auto cap to 12GB and simplify OOM hint

- Increase setup_nodejs auto heap clamp from 4GB to 12GB for heavy frontend builds
- Keep lower bound at 1GB and preserve user override precedence
- Simplify error_handler Node OOM output to a single concise hint
- Align error_handler heap suggestion clamp to 12GB
This commit is contained in:
CanbiZ (MickLesk)
2026-04-23 13:58:55 +02:00
parent 4241fd10da
commit 450c1f37a0
2 changed files with 7 additions and 11 deletions

View File

@@ -347,18 +347,14 @@ error_handler() {
if [[ -z "$heap_hint_mb" ]] || ((heap_hint_mb < 1024)); then
heap_hint_mb=1024
elif ((heap_hint_mb > 4096)); then
heap_hint_mb=4096
elif ((heap_hint_mb > 12288)); then
heap_hint_mb=12288
fi
if declare -f msg_warn >/dev/null 2>&1; then
msg_warn "Detected possible Node.js heap OOM during build."
msg_warn "Try: export NODE_OPTIONS=\"--max-old-space-size=${heap_hint_mb}\" before npm/pnpm/yarn build."
msg_warn "Recommendation: call setup_nodejs before build steps so heap defaults are applied automatically."
msg_warn "Possible Node.js heap OOM. Try: export NODE_OPTIONS=\"--max-old-space-size=${heap_hint_mb}\" and rerun the build."
else
echo -e "${YW}Detected possible Node.js heap OOM during build.${CL}"
echo -e "${YW}Try: export NODE_OPTIONS=\"--max-old-space-size=${heap_hint_mb}\" before npm/pnpm/yarn build.${CL}"
echo -e "${YW}Recommendation: call setup_nodejs before build steps so heap defaults are applied automatically.${CL}"
echo -e "${YW}Possible Node.js heap OOM. Try: export NODE_OPTIONS=\"--max-old-space-size=${heap_hint_mb}\" and rerun the build.${CL}"
fi
fi