lib: fix --preserve-symlinks-main
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 called tryExtensions
which in turn calls tryFile
. The tryFile
function originally only had a check for the --preserve-symlinks
flag, so I have added a check for --preserve-symlinks-main
as well.