We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4b3d493 commit a10ce67Copy full SHA for a10ce67
lib/module.js
@@ -129,7 +129,7 @@ const noopDeprecateRequireDot = util.deprecate(function() {},
129
Module._findPath = function(request, paths) {
130
var exts = Object.keys(Module._extensions);
131
132
- if (request.charAt(0) === '/') {
+ if (path.isAbsolute(request)) {
133
paths = [''];
134
}
135
@@ -142,6 +142,8 @@ Module._findPath = function(request, paths) {
142
143
// For each path
144
for (var i = 0, PL = paths.length; i < PL; i++) {
145
+ // Don't search further if path doesn't exist
146
+ if (paths[i] && internalModuleStat(paths[i]) < 1) continue;
147
var basePath = path.resolve(paths[i], request);
148
var filename;
149
0 commit comments