Last active
August 6, 2020 09:34
-
-
Save DanielHoffmann/c57b57bbb41757fc6117bc5724c69fe5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cwd = process.cwd() | |
module.exports = function requireResolve(moduleName) { | |
const resolveOpts = { | |
paths: [ | |
// will prefer this folder: | |
path.resolve(cwd, '..', 'some-dep', 'node_modules'), | |
// over this folder: | |
path.resolve(cwd, 'node_modules'), | |
], | |
} | |
return require.resolve(moduleName, resolveOpts) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment