Repository navigation
fix: restore the CJS bridge namespace for Node 24 require(esm) under tsImport() - #802
Merged
privatenumber merged 5 commits intoSep 20, 2026
Conversation
5 of 6 tasks
7 of 8 tasks
Owner
|
This issue is now resolved in v4.23.14. If you're able to, your sponsorship would be very much appreciated. |
1 task
github-actions Bot
pushed a commit
to modify-dev/harbor
that referenced
this pull request
Oct 19, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [tsx](https://tsx.hirok.io) ([source](https://github.com/privatenumber/tsx)) | [`4.23.13` → `4.23.15`](https://renovatebot.com/diffs/npm/tsx/4.23.13/4.23.15) |  |  | --- >⚠️ **Warning** > > Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/99) for more information. --- ### Release Notes <details> <summary>privatenumber/tsx (tsx)</summary> ### [`v4.23.15`](https://github.com/privatenumber/tsx/releases/tag/v4.23.15) [Compare Source](privatenumber/tsx@v4.23.14...v4.23.15) ##### Bug Fixes - exclude bare builtins from namespace inheritance ([38e1588](privatenumber/tsx@38e1588)) - expose require.cache and require.extensions to tsImport CommonJS modules ([2da3407](privatenumber/tsx@2da3407)) - make namespaced register() overloads portable for declaration emit ([562c434](privatenumber/tsx@562c434)) *** This release is also available on: - [npm package (@​latest dist-tag)](https://www.npmjs.com/package/tsx/v/4.23.15) ### [`v4.23.14`](https://github.com/privatenumber/tsx/releases/tag/v4.23.14) [Compare Source](privatenumber/tsx@v4.23.13...v4.23.14) ##### Bug Fixes - restore the CJS bridge namespace for Node 24 require(esm) under tsImport() ([#​802](privatenumber/tsx#802)) ([6e5236b](privatenumber/tsx@6e5236b)) *** This release is also available on: - [npm package (@​latest dist-tag)](https://www.npmjs.com/package/tsx/v/4.23.14) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - "before 9am on tuesday" - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzMuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjE2Ny4wIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==--> Reviewed-on: https://code.futo.org/harbor/harbor/pulls/1786
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Node 24,
tsImport()throwsERR_MODULE_NOT_FOUNDwhen the imported file is a CommonJS-package.tsthat re-exports an ES module. The same code loads on Node 22, so upgrading to Node 24 breaks programs that load their config throughtsImport().In a CommonJS package:
Node 24 reports
Cannot find module '.../dep.mjs?namespace=<id>' imported from .../config.ts?namespace=<id>(#801).Changes
tsx's CommonJS bridge appends
?namespace=<id>to each resolved filename for per-tsImport()requirecache isolation. On Node 24,require(esm)hands that filename to the ESM loader, andpathToFileURL()represents the?in the URL as%3F. tsx's resolve hook only read a namespace from a real query string, so Node looked for the filenamedep.mjs?namespace=<id>(represented in the URL asdep.mjs%3Fnamespace=<id>) and missed.The resolve hook now recognizes that bridge artifact and restores it as the namespace query, so namespaced resolution and isolation apply as before. It reverses only the
%25layer thatpathToFileURL()added, then decodes the recovered query values; it rewrites the pathname only when the trailing encoded query'snamespacematches the activetsImport()namespace. Literal percent-encoded question-mark paths (file%3Fname.ts) and tsx's markedtsx-commonjs-virtual-query=1URLs stay untouched.Closes #801