Skip to content

build: 修复 NODE_OPTIONS 的跨平台设置 - #515

Open
GoodScholar wants to merge 1 commit into
element-plus-x:updata-2602from
GoodScholar:codex/fix-build-node-options
Open

GoodScholar wants to merge 1 commit into
element-plus-x:updata-2602from
GoodScholar:codex/fix-build-node-options

Conversation

@GoodScholar

@GoodScholar GoodScholar commented Sep 14, 2026

Copy link
Copy Markdown

变更说明

修复 core 的 ES/UMD 构建脚本在 macOS/Linux 下未向子进程导出 NODE_OPTIONS 的问题。

变更前

脚本通过 set NODE_OPTIONS="--max-old-space-size=4096" && ... 设置内存参数。在 POSIX shell 中,set 不会导出该环境变量;清除外部 NODE_OPTIONS 后,后续 Node 进程读取该变量为 undefined

变更后

使用 cross-env-shell 包裹原有的完整命令链,让类型生成、vue-tsc 和 Vite 都继承 --max-old-space-size=4096,保留原有执行顺序及 && 失败中断语义。

新增开发依赖 cross-env@^7.0.3,兼容项目声明的 Node >=18;同步 pnpm 锁文件,仅增加该依赖所需条目。

变更类型

  • 📦 build: 构建相关

验证

  • macOS 上复现原有 ES/UMD 脚本前缀未导出 NODE_OPTIONS
  • 使用真实 pnpm 10.6.5 和 cross-env-shell 7.0.3,复制修改后的构建脚本到临时包,以探针替代类型生成、vue-tsc 和 Vite:ES/UMD 的正常链路、类型生成失败、类型检查失败共 6 项检查全部通过。
  • 三个阶段均收到预期环境变量;构建参数保留;前置阶段失败后停止执行,退出码为 23。
  • pnpm install --frozen-lockfile --ignore-scripts --offline --lockfile-only 通过。
  • 修改的 package.json 通过 ESLint;changeset Markdown 被现有 ESLint 配置忽略。
  • git diff --check 通过。

未运行完整 ES/UMD 构建,未在 Windows/Linux 上实测,不据此声称构建 OOM 已解决。

相关 Issue

无关联 Issue。

Changeset

  • 已添加 patch changeset。

Summary by CodeRabbit

  • Bug Fixes
    • Improved build reliability across macOS, Linux, and Windows by applying memory limits consistently during type generation, type checking, and packaging.
  • Chores
    • Updated build tooling to support cross-platform environment variable handling.
    • Added a patch release note for the build reliability fix.

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 78cf632e-6bf8-498f-995d-0778975beb67

📥 Commits

Reviewing files that changed from the base of the PR and between 39d2dbd and 0ab47bc.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • .changeset/fix-build-node-options.md
  • packages/core/package.json

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The build scripts now set NODE_OPTIONS with cross-env-shell for cross-platform memory limits. The package adds cross-env and records a patch release.

Changes

Build memory options

Layer / File(s) Summary
Cross-platform build scripts
packages/core/package.json, .changeset/fix-build-node-options.md
The build:es and build:umd scripts now set NODE_OPTIONS=--max-old-space-size=4096 with cross-env-shell. The package adds cross-env as a development dependency. A patch changeset records the build memory handling fix.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 0ab47

The build scripts now configure the Node.js memory limit cross-platform, with the dependency and lockfile entry aligned. Full builds remain normal follow-up validation, not a merge-blocking risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: fixing the cross-platform setting of NODE_OPTIONS in the build scripts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant