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 ofGLOBAL_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 thenode_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