-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
lib: fix --preserve-symlinks-main #51312
Conversation
Fixed resolving relative imports when symlink to main file called without file extension Fixies: nodejs#41000
Review requested:
|
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Is it necessary to amend the commit message, or will it be fixed during the merge process? |
Landed in d0e4550 |
Collaborators can specify a different commit message by landing manually the PR. If you fix it yourself, we can use automation to land the PR quicker, but it's no biggie. Thanks for the contribution! |
Fixes resolving main module when the `argv[1]` was pointing to a symlink without its file extension. PR-URL: nodejs#51312 Fixes: nodejs#41000 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Fixes resolving main module when the `argv[1]` was pointing to a symlink without its file extension. PR-URL: nodejs#51312 Fixes: nodejs#41000 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
lib: fix --preserve-symlinks-main
When the
--preserve-symlinks-main
flag is used when running a node, the main file path is resolved to the target path instead of the symlink path. This cause issues with relative imports. This problem occurs when the called symlink does not contain a file extension(i.e.node package
,node package/file
).In the
loader.js
file, there is a function calledtryExtensions
which in turn callstryFile
. ThetryFile
function originally only had a check for the--preserve-symlinks
flag, so I have added a check for--preserve-symlinks-main
as well.Fixes: #41000