Skip to content

fix(cli): keep oxnode watch --tsconfig over an --env-file's TS_NODE_PROJECT - #877

Merged
Brooooooklyn merged 2 commits into
mainfrom
fix/watch-tsconfig-env-file
Oct 21, 2026
Merged

Brooooooklyn merged 2 commits into
mainfrom
fix/watch-tsconfig-env-file

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Member

Closes #876.

before:  --tsconfig cli.json  →  child env: OXC_TSCONFIG_PATH=cli.json, TS_NODE_PROJECT removed
         --env-file=.env      →  Node.js adds TS_NODE_PROJECT=env.json back
         binding reads TS_NODE_PROJECT first  →  env.json ✗

now:     child env: OXC_TSCONFIG_PATH=cli.json, TS_NODE_PROJECT=cli.json
         Node.js keeps a variable the environment already has  →  cli.json ✓
  • tsconfigEnv() sets TS_NODE_PROJECT to the resolved --tsconfig path instead of removing it, as the issue suggests.
  • src/lib.rs: when TS_NODE_PROJECT and OXC_TSCONFIG_PATH name the same path, the warnings (missing or unreadable config) name OXC_TSCONFIG_PATH, the variable --tsconfig stands for. Without this, oxnode watch --tsconfig missing.json would blame TS_NODE_PROJECT, which the user never set. Which config is used does not change.

Tests

  • watch-cli.spec.ts: --tsconfig cli.json --env-file=.env, where .env sets both TS_NODE_PROJECT and OXC_TSCONFIG_PATH to other configs; the run uses cli.json. Fails before the fix.
  • tsconfig-discovery.spec.ts: both variables naming one missing file gives the OXC_TSCONFIG_PATH warning.
  • watch-args.spec.ts: the new env values.
  • Checked: Node.js 22.18, 24.12 and 24.22 keep the process's value over --env-file, --env-file-if-exists and several env files. No other CLI path passes --tsconfig to a child.

One side effect, for the maintainers

A process the app starts now inherits TS_NODE_PROJECT as well. If it picks its own config by changing only OXC_TSCONFIG_PATH, the inherited TS_NODE_PROJECT wins, since it is read first. This is the same as running with TS_NODE_PROJECT=cli.json set in the shell. Avoiding it would need the child's preload to undo the env file's value, which every loader embedding the watcher would have to do too, so this PR keeps the simple fix.

🤖 Generated with Claude Code

…ROJECT

--tsconfig now sets TS_NODE_PROJECT to the same path as OXC_TSCONFIG_PATH
instead of removing it. Node.js keeps a variable the environment already
has, so an env file can no longer override the choice. When both name
the same path, the binding's warnings name OXC_TSCONFIG_PATH.

Closes #876

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T10:18:11.434119Z c46827d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Brooooooklyn
Brooooooklyn merged commit c1853aa into main Oct 21, 2026
67 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix/watch-tsconfig-env-file branch October 21, 2026 12:15
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.

oxnode watch --tsconfig is overridden by TS_NODE_PROJECT from --env-file

1 participant