Skip to content

fix(repo): use tsx fallback on Node 26+ for NODE_OPTIONS#1620

Open
gabroberge wants to merge 1 commit into
arktypeio:mainfrom
gabroberge:ci/node-26-node-options
Open

fix(repo): use tsx fallback on Node 26+ for NODE_OPTIONS#1620
gabroberge wants to merge 1 commit into
arktypeio:mainfrom
gabroberge:ci/node-26-node-options

Conversation

@gabroberge
Copy link
Copy Markdown

@gabroberge gabroberge commented May 17, 2026

Summary

  • ark/repo/nodeOptions.js: From Node 26 onward, --experimental-transform-types is not allowed in NODE_OPTIONS, so any node child process started after addNodeDevOptions() could fail with: --experimental-transform-types is not allowed in NODE_OPTIONS.
  • Version gate is tightened to (major > 22 && major < 26) || (major === 22 && minor >= 7) so 26+ uses the --import tsx fallback (same broad approach as pre–22.7).
  • Refactor: flag selection lives in versionedFlagsFor(major, minor); the fallback path logs getFallbackReason(major) (distinct copy for 26+ vs other fallback cases) then returns "--import tsx".

Test plan

  • pnpm build on Node 26+ (or rely on CI compatibility (ubuntu-latest, latest))
  • Optional smoke: Node 22 / 24 still uses --experimental-transform-types --no-warnings

Note

Scope: minimal fix so CI passes on Node 26+; not a broader build refactor.

I’m not asserting we should keep tsx for Node ≥ 26 forever—only that it unblocks today’s NODE_OPTIONS restriction. Maintainers can propose a native or alternative approach when they see fit.

Copy link
Copy Markdown
Contributor

@pullfrog pullfrog Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No new issues found.

TL;DR — Gates --experimental-transform-types to Node 22.7 through 25.x and falls back to --import tsx on Node 26+, where the flag was removed and is rejected inside NODE_OPTIONS.

Key changes

  • Cap experimental-transform-types at Node 25 — predicate is now (major > 22 && major < 26) || (major === 22 && minor >= 7), so Node 26+ takes the tsx fallback path.
  • Extract versionedFlagsFor(major, minor) — flag selection moves out of the top-level ternary into a named function, with a sibling getFallbackReason(major) that emits distinct copy for the 26+ case vs the pre-22.7 case.

Summary | 1 file | 1 commit | base: mainci/node-26-node-options


Node 26 removes --experimental-transform-types

Before: addNodeDevOptions() injected --experimental-transform-types --no-warnings into NODE_OPTIONS for any major > 22, so child node processes on Node 26+ aborted with --experimental-transform-types is not allowed in NODE_OPTIONS.
After: Node 26+ logs a fallback reason and uses --import tsx instead, matching the pre-22.7 fallback shape.

Verified against the Node v26.1.0 TypeScript docs: the v26.0.0 history entry reads "Removed --experimental-transform-types flag." Type stripping itself remains on by default in 26, but the transform flag is gone — passing it via NODE_OPTIONS is what triggers the error this PR avoids. The single consumer is ark/repo/ts.js, which calls addNodeDevOptions() before spawning a node child via execSync, so the fix lands exactly where it needs to.

ark/repo/nodeOptions.js

Pullfrog  | View workflow run | Using Claude Opus𝕏

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

Labels

None yet

Projects

Status: To do

Development

Successfully merging this pull request may close these issues.

1 participant