Version
v17.6.0
Platform
Darwin VMBP2021.local 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
Subsystem
esm resolver
What steps will reproduce the bug?
https://github.com/vjpr/issue-node-experimental-specifier-resolution
How often does it reproduce? Is there a required condition?
Pnpm relies on realpaths. Package managers relying on hoisting will not encounter this issue as they will eventually find the package hoisted.
This is why it was probably hard to detect.
What is the expected behavior?
Realpath should be called when --experimental-specifier-resolution=node is set.
What do you see instead?
It's not being called, and modules are resolved using logical paths.
Additional information
https://github.com/nodejs/node/blame/e5c1fd7a2a1801fd75bdde23b260488e85453eb2/lib/internal/modules/esm/resolve.js#L367-L410
Notice how realpathSync is not called if the --experimental-specifier-resolution=node option is set.
Version
v17.6.0
Platform
Darwin VMBP2021.local 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
Subsystem
esm resolver
What steps will reproduce the bug?
https://github.com/vjpr/issue-node-experimental-specifier-resolution
How often does it reproduce? Is there a required condition?
Pnpm relies on realpaths. Package managers relying on hoisting will not encounter this issue as they will eventually find the package hoisted.
This is why it was probably hard to detect.
What is the expected behavior?
Realpath should be called when
--experimental-specifier-resolution=nodeis set.What do you see instead?
It's not being called, and modules are resolved using logical paths.
Additional information
https://github.com/nodejs/node/blame/e5c1fd7a2a1801fd75bdde23b260488e85453eb2/lib/internal/modules/esm/resolve.js#L367-L410
Notice how
realpathSyncis not called if the--experimental-specifier-resolution=nodeoption is set.