lib: fix --preserve-symlinks-main#51312
Merged
aduh95 merged 3 commits intonodejs:mainfrom Jan 10, 2024
Merged
Conversation
Fixed resolving relative imports when symlink to main file called without file extension Fixies: nodejs#41000
Collaborator
|
Review requested:
|
aduh95
reviewed
Dec 29, 2023
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95
approved these changes
Dec 30, 2023
Collaborator
Collaborator
Contributor
Author
|
Is it necessary to amend the commit message, or will it be fixed during the merge process? |
Contributor
|
Landed in d0e4550 |
Contributor
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! |
marco-ippolito
pushed a commit
to marco-ippolito/node
that referenced
this pull request
Jan 12, 2024
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>
Medhansh404
pushed a commit
to Medhansh404/node
that referenced
this pull request
Jan 19, 2024
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>
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
lib: fix --preserve-symlinks-main
When the
--preserve-symlinks-mainflag 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.jsfile, there is a function calledtryExtensionswhich in turn callstryFile. ThetryFilefunction originally only had a check for the--preserve-symlinksflag, so I have added a check for--preserve-symlinks-mainas well.Fixes: #41000