Resolve a dependency from within the context of another package.
Useful for hacks, monkeypatching or wrappers that require manipulation of the exact dependency that would be loaded by a package.
npm install --save pkgresolve
var resolve =// Resolve 'through' from locally installed 'tape'// Resolve 'npmconf' from globally installed 'npm'
# Resolve 'through' from locally installed 'tape'pkgresolve tape through# Resolve 'npmconf' from globally installed 'npm'pkgresolve --global npm npmconf
Due to deduplication,
child is not guaranteed to exist at that
location. You don't even need to call
npm dedupe for this to happen –
npm will not install something that is already installed in the
pkgresolve is a more robust method.
This intentially breaks the encapsulation provided by node/npm's module system. Don't use this unless you have to.