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
Some built-in modules are always preferentially loaded if their identifier is passed to require(). For instance, require('http') will always return the built-in HTTP module, even if there is a file by that name.
Version
23.6.0
Platform
Subsystem
No response
What steps will reproduce the bug?
node index.js
How often does it reproduce? Is there a required condition?
Anytime the specifier is also the same name as a NodeJS built in (presumably)
What is the expected behavior? Why is that the expected behavior?
It should return a URL string, as per the spec, eg:
file:///path/to/node_modules/process/index.js
What do you see instead?
A specifier for a NodeJS built-in, e.g.
node:process
Additional information
I created a repro repo
https://github.com/thescientist13/import-meta-resolve-demo
And some more details
https://github.com/thescientist13/import-meta-resolve-demo?tab=readme-ov-file#node-built-ins-hijacking-dependencies
FWIW, it seems
require.resolve
exhibits the same behaviorThe text was updated successfully, but these errors were encountered: