Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experimental-specifier-resolution=node doesn't resolve realpath #42195

Closed
vjpr opened this issue Mar 3, 2022 · 0 comments · Fixed by #42197
Closed

experimental-specifier-resolution=node doesn't resolve realpath #42195

vjpr opened this issue Mar 3, 2022 · 0 comments · Fixed by #42197
Labels
loaders Issues and PRs related to ES module loaders

Comments

@vjpr
Copy link

vjpr commented Mar 3, 2022

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

pnpm install
./index.sh

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.

@meixg meixg added the loaders Issues and PRs related to ES module loaders label Mar 3, 2022
nodejs-github-bot pushed a commit that referenced this issue Mar 6, 2022
Fix: #42195

PR-URL: #42197
Fixes: #42195
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
sxa pushed a commit to sxa/node that referenced this issue Mar 7, 2022
Fix: nodejs#42195

PR-URL: nodejs#42197
Fixes: nodejs#42195
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
danielleadams pushed a commit to danielleadams/node that referenced this issue Apr 21, 2022
Fix: nodejs#42195

PR-URL: nodejs#42197
Fixes: nodejs#42195
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
danielleadams pushed a commit that referenced this issue Apr 24, 2022
Fix: #42195

PR-URL: #42197
Fixes: #42195
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
danielleadams pushed a commit that referenced this issue Apr 24, 2022
Fix: #42195

PR-URL: #42197
Fixes: #42195
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
danielleadams pushed a commit that referenced this issue Apr 24, 2022
Fix: #42195

PR-URL: #42197
Fixes: #42195
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
xtx1130 pushed a commit to xtx1130/node that referenced this issue Apr 25, 2022
Fix: nodejs#42195

PR-URL: nodejs#42197
Fixes: nodejs#42195
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
shanedg added a commit to shanedg/trshcmpctr that referenced this issue Jun 21, 2022
Bug in `--experimental-specifier-resolution=node` fixed in ^16.15.0
See: nodejs/node#42195
shanedg added a commit to shanedg/trshcmpctr that referenced this issue Jun 21, 2022
Bug in `--experimental-specifier-resolution=node` fixed in ^16.15.0
See: nodejs/node#42195
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
loaders Issues and PRs related to ES module loaders
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants