diff options
author | Phillip Johnsen <johphi@gmail.com> | 2016-03-13 21:40:38 +0100 |
---|---|---|
committer | Phillip Johnsen <johphi@gmail.com> | 2016-03-29 21:39:26 +0200 |
commit | d38503ab01c607ca55b4816e2c249411a3f10269 (patch) | |
tree | 80ad537aadc75f0c029e03530c19bdee1ce3e524 /lib | |
parent | ccd81889fa55024ce77ecbc3e869479978fc98f2 (diff) | |
download | android-node-v8-d38503ab01c607ca55b4816e2c249411a3f10269.tar.gz android-node-v8-d38503ab01c607ca55b4816e2c249411a3f10269.tar.bz2 android-node-v8-d38503ab01c607ca55b4816e2c249411a3f10269.zip |
module: prioritize current dir for local lookups
This fixes a bug where a 3rd party module found in node_modules,
would be preferred over a ./local module with the same name.
Fixes: https://github.com/nodejs/node/issues/5684
PR-URL: https://github.com/nodejs/node/pull/5689
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/module.js | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/module.js b/lib/module.js index 74db325dab..b992ca8faf 100644 --- a/lib/module.js +++ b/lib/module.js @@ -250,8 +250,7 @@ Module._resolveLookupPaths = function(request, parent) { if (!parent || !parent.id || !parent.filename) { // make require('./path/to/foo') work - normally the path is taken // from realpath(__filename) but with eval there is no filename - var mainPaths = ['.'].concat(modulePaths); - mainPaths = Module._nodeModulePaths('.').concat(mainPaths); + var mainPaths = ['.'].concat(Module._nodeModulePaths('.'), modulePaths); return [request, mainPaths]; } |