Skip to content

Does the require.resolve paths option work just like the baseDir option? #188

Open
@watson

Description

Since Node.js v8.9.0, a new paths option was made available to the core Node.js require.resolve function:

paths <string[]> Paths to resolve module location from. If present, these paths are used instead of the default resolution paths, with the exception of GLOBAL_FOLDERS like $HOME/.node_modules, which are always included. Note that each of these paths is used as a starting point for the module resolution algorithm, meaning that the node_modules hierarchy is checked from this location.

As far as I can see, if just given a single element in the paths array, this works identical to the baseDir option of this module. The new paths features does however take into account the GLOBAL_FOLDERS, which I'm not sure if this module does?

I ask because I would like to feature detect this and use the internal Node.js function if available, but fall back to this module if not. But I wasn't sure if the behavior was 100% identical 🤔

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions