Skip to content

vpx: watch reports for vpx --watch, and vpx watch on oxc-node's watcher #3141

Closed

Description

@fengmk2

Follow-up to #2936. vpx --watch is Node.js watch mode with the script loader. It restarts when an imported file changes, but not in two common cases, which tsx watch misses as well:

  • A tsconfig edit, such as a new paths mapping.
  • A file an import is waiting for, created after the first run (import "./later.js", then later.ts is added).

It also has none of tsx watch's options: include and exclude globs, clearing the screen, rerunning on Enter, a kill timeout, or polling for Docker, WSL, and network drives.

oxc-node added both pieces in oxc-project/oxc-node#861, which #2936 syncs (ce22828):

  1. Dependency reports. With enable_watch_report on, the binding records the tsconfig files it reads and the paths a failed resolve looked for. @oxc-node/core's loader sends them as { "watch:import": [url] } over IPC, the message Node.js's own watcher already reads, so node --watch restarts on them.
  2. oxnode watch. A tsx-style watcher, about 2,500 lines of TypeScript on Node.js built-ins.

Plan

  1. Reports for vpx --watch. Forward enable_watch_report and take_watch_dependencies in packages/cli/binding/src/oxc_node.rs. Port the relay into vpx's loader: the preload reports on the in-thread path, and the off-thread hooks send through a channel to the main thread. It is on only when WATCH_REPORT_DEPENDENCIES is set. vpx --watch then restarts on tsconfig edits and created files, with no new process.
  2. Signal ack. Port the child's side of OXNODE_SIGNAL_ACK into the preload, so the watcher does not deliver Ctrl+C twice when it runs in a pipe or the background.
  3. vpx watch. Run oxc-node's watcher, bundled from the vendored source, once Expose the oxnode watch watcher as an entry an embedder can run with its own loader oxc-project/oxc-node#871 gives it an entry that takes vpx's loader and name.
    • Both CLIs route vpx watch <script>: the global vpx execs Node.js with the bundled watcher, and the local bin calls it in process.
    • Add docs and snapshots, and a vp migrate rule that rewrites tsx watch to vpx watch.

Notes

Activity

  1. self-assigned this
    on Oct 20, 2026
  2. added theissue type on Oct 20, 2026
  3. fengmk2 commented on Oct 21, 2026

    @fengmk2
    MemberAuthor

    Done in #3164 and #3167, with one change to the plan:

    • Reports and signal ack (steps 1 and 2) shipped as planned in feat(vpx): run vpx --watch on oxc-node's watcher #3164: vpx --watch restarts on tsconfig edits, including a file it extends, and on a file a failed import looked for once it is created, and a Ctrl+C reaches the script once when the watcher is not the terminal's foreground job.
    • The watcher runs as vpx --watch, not vpx watch (step 3). vpx --watch now runs oxc-node's watcher with the vpx loader instead of Node.js' own watch mode, and takes tsx watch's options (--include, --exclude, --clear-screen, --kill-timeout, --rerun-on-enter, --poll, …). vpx watch stays package mode and still runs the npm package watch, so the subcommand in the notes above did not happen. Through vpx, Node.js' --watch-path (use --include) and --test --watch are errors now.
    • fix(vpx): handle --experimental-config-file and Windows Ctrl+C #3167 fixed script detection for a bare --experimental-config-file, and made the global vpx and vp run on Windows wait for the script's own Ctrl+C cleanup.

    Not done here:

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

Priority

None yet

Effort

None yet

Target date

None yet

Start date

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions