-
-
Notifications
You must be signed in to change notification settings - Fork 37.4k
Don't resolve symlinks when requiring #3402
Copy link
Copy link
Closed
Labels
discussIssues opened for discussion and feedback.Issues opened for discussion and feedback.moduleIssues and PRs related to the module subsystem.Issues and PRs related to the module subsystem.
Description
Activity
Metadata
Metadata
Assignees
Labels
discussIssues opened for discussion and feedback.Issues opened for discussion and feedback.moduleIssues and PRs related to the module subsystem.Issues and PRs related to the module subsystem.
Currently, Node.js resolves symlinks when requiring and then uses the real location of the package/file as its __filename and __dirname instead of the symlinked one.
This is a problem because symlinked modules don't act the same as locally copied modules.
For example:
works, but
does not, because dep1 does not act like it's located in the node_modules directory of module and thus cannot find dep2.
This is especially a problem when one wants to symlink modules that have peer-dependencies.
Therefore, I suggest changing the behavior to no longer resolve symlinks.
What do you think?