You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found by the Node compat matrix on Windows (#10385 / PR #10403), which flagged sea, sqlite, test and test/reporters as perry-extra — resolved by
Perry, unresolved by Node.
The bug
These are Node's prefix-only builtins. Node deliberately does not expose
them under their bare names because those are live npm package names. Measured
on the pinned oracle (Node 26.5.1):
Perry claims all of them, so a project with a test or sqlite dependency gets
Perry's builtin instead of the package it asked for. test and sqlite are
both real, popular npm packages.
An attempted fix that does NOT work
Gating is_native_module / is_native_module_with_externals on a PREFIX_ONLY_BUILTINS list — return false when the name is in the list and the
path does not start with node: — was tried in PR #10403 and reverted
(255e5d98e, reverted by b3adf5f17). Unit tests passed; the end-to-end matrix
showed it was a net regression:
module
bare (before → after)
node: form (before → after)
sea
perry-extra → both-none (correct)
match → UNRESOLVED
sqlite
perry-extra → both-none (correct)
SHAPE-DIFF → UNRESOLVED
test
perry-extra → perry-extra (unchanged)
SHAPE-DIFF → SHAPE-DIFF
So it broke node:sea and node:sqlite, which previously worked, and did not
fix bare test at all.
Two things that implies, and which a real fix has to account for:
Some caller normalises before calling. If is_native_module is reached
with the node: prefix already stripped, a gate keyed on the prefix being
present cannot distinguish the two forms and wrongly rejects the prefixed
one. The prefix decision has to happen where the original specifier is still
intact — at the import-resolution site, not in the predicate.
Bare test resolves through a different path. It survived the gate
entirely, so is_native_module is not the only mechanism claiming these
names. test/reporters is not even in NATIVE_MODULES, yet the matrix
reports it as perry-extra, which points the same way.
Activity
[-]Windows/modules: bare // resolve as builtins, shadowing npm packages[/-][+]Prefix-only builtins (sea, sqlite, test, test/reporters) resolve bare, shadowing npm packages[/+]