Skip to content

fix(ci): switch tsdown config-loader from tsx to unrun#349

Merged
antfu merged 3 commits into
mainfrom
antfu/fix-ci-errors
May 15, 2026
Merged

fix(ci): switch tsdown config-loader from tsx to unrun#349
antfu merged 3 commits into
mainfrom
antfu/fix-ci-errors

Conversation

@antfu
Copy link
Copy Markdown
Member

@antfu antfu commented May 15, 2026

Description

CI on main has been failing since d8efd109 chore: update deps. Two independent regressions stack on top of each other; both have to be fixed for CI to go green.

1. tsx config-loader → unrun. packages/core's build invokes tsdown --config-loader=tsx. On Node 24.15.0 (CI's lts/*), tsx's loader appends ?tsx-namespace=<timestamp> to module specifiers and Node 24.15.0 then readFileSyncs node:child_process?tsx-namespace=..., failing with ENOENT. Reproduces on tsx 4.21.1 and 4.22.0 alike — it's a tsx-vs-Node-24.15.0 interop issue, not a tsx-version-specific bug. Local Node 24.12.0 doesn't trip it. Switching to --config-loader=unrun in packages/core and the three example plugins routes around the broken hook while still handling the config's build:before / build:done dynamic .ts imports.

2. devframe ^0.2.30.2.2. Unblocking the build surfaced 86 typecheck errors. Every declare module '@vitejs/devtools-kit' augmentation in kit/core (registering RPC server/client functions and shared-state keys) stops merging into the re-exported DevToolsRpc* interfaces under devframe 0.2.3, leaving them as empty bases. Reverting the catalog and submodule pin to 0.2.2 restores the green typecheck observed on commit 30859972.

Linked Issues

Upstream tsx tracking: privatenumber/tsx#750

Additional context

The first push on this branch pinned tsx to ~4.21.0 — that was a false fix, since the tsx bug isn't version-dependent. The follow-up commits replace it with the loader switch plus the devframe revert. Verified locally on Node 24.15.0: pnpm build, pnpm test (190/190), pnpm typecheck (0 errors), and pnpm lint all green. The devframe-side cause should be investigated upstream; revisit when 0.2.4+ ships.

antfu added 2 commits May 15, 2026 11:18
tsx 4.22.0 upgraded its bundled esbuild to 0.28, which broke node:*
builtin resolution in tsx's loader hooks — specifiers like
`node:child_process?tsx-namespace=...` are now read as files and fail
with ENOENT. This breaks `packages/core`'s `tsdown --config-loader=tsx`
build because the config's `build:before`/`build:done` hooks dynamically
import `.ts` files that use Node builtins.

Add tsx to overrides so transitive peer-dep resolutions don't pull
4.22.0 back in via vite/vitepress/tsdown. Drop pin when tsx#756 ships.

Refs: privatenumber/tsx#750
The previous tsx pin to ~4.21.0 was a false fix. The bug exists in tsx
4.21.x too — it surfaces on Node 24.15.0 (CI's lts/*) but not 24.12.0.
tsx's loader hook appends `?tsx-namespace=<timestamp>` to specifiers and
Node 24.15.0 then attempts a readFileSync on `node:child_process?...`,
failing with ENOENT.

Switch tsdown's --config-loader from `tsx` to `unrun` in core and the
three example plugins. unrun handles the config and the build:before /
build:done hooks' dynamic `.ts` imports without going through tsx's
loader hook.

Revert the catalog tsx pin and override added in the previous commit
since they no longer carry weight.
@antfu antfu changed the title fix(ci): pin tsx to ~4.21.0 to avoid 4.22.0 node: builtin regression fix(ci): switch tsdown config-loader from tsx to unrun May 15, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 15, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@vitejs/devtools@349
npm i https://pkg.pr.new/@vitejs/devtools-kit@349
npm i https://pkg.pr.new/@vitejs/devtools-rolldown@349
npm i https://pkg.pr.new/@vitejs/devtools-self-inspect@349

commit: 90cca62

The 0.2.3 bump from `chore: update deps` (d8efd10) made the build fail
first via the tsx loader bug — once that was unblocked by switching to
the unrun config loader, 86 typecheck errors surfaced. Every `declare
module '@vitejs/devtools-kit'` augmentation in kit/core (registering
RPC server functions, client functions, and shared-state keys) stopped
merging into the re-exported `DevToolsRpc*` interfaces, leaving them as
the empty base from devframe/types.

Pin the catalog and submodule back to 0.2.2 to restore the green state
on commit 3085997. The devframe-side cause needs investigating
upstream; revisit when 0.2.4+ ships.
@antfu antfu merged commit d1dddbf into main May 15, 2026
10 checks passed
@antfu antfu deleted the antfu/fix-ci-errors branch May 15, 2026 04:17
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