Skip to content

Require with a relative path should take into account it comes from a symbolic links #5481

Closed
@julienw

Description

@julienw

Please have a look at this gist for context: https://gist.github.com/julienw/7c31988d43b639dcfde2

Basically we have 2 files in 2 different directories. Yet in one another directory we have 2 links to these 2 files. If file1 has require('./file2') it will fail because node's require is looking only in the "real" directory where file1 is. I suggest to augment this behavior to look both in this directory and where the symbolic link is located.

I understand it's not very easy to do given the current code as node doesn't keep track that it loaded the file from a symbolic link in the first place. I'd be happy to contribute with some guidance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.moduleIssues and PRs related to the module subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions