Skip to content

Feature request: add preserveSymlinks option to require.resolve() #18009

@searls

Description

@searls

According to the docs, the only option currently on require.resolve(path[, options]) is paths. I have a project that I'm trying to eliminate a dependency on browserify/resolve, and the only thing holding me back is that my library needs to know the resolved path of a given string while preserving symlinks, regardless of whatever the end-user has set their global Node environment to.

I propose a second option be added to this method named preserveSymlinks which behaves the same way as the --preserve-symlinks CLI flag and ENV var, but is local only to the call on require.resolve().

I attempted to work around this by changing the NODE_PRESERVE_SYMLINKS env var at runtime, but it had no effect.

If this seems like an agreeable enhancement to require.resolve, I'd happily take a stab at a PR

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.stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions