Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ Module._nodeModulePaths = function(from) {
// guarantee that 'from' is absolute.
from = path.resolve(from);


// note: this approach *only* works when the path is guaranteed
// to be absolute. Doing a fully-edge-case-correct path.split
// that works on both Windows and Posix is non-trivial.
Expand All @@ -216,7 +217,7 @@ Module._nodeModulePaths = function(from) {
paths.push(dir);
}

return paths;
return [from].concat(paths);
};


Expand Down Expand Up @@ -250,7 +251,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);
var mainPaths = modulePaths;
mainPaths = Module._nodeModulePaths('.').concat(mainPaths);
return [request, mainPaths];
}
Expand Down