Skip to content

Commit

Permalink
module: minor performance improvement
Browse files Browse the repository at this point in the history
PR-URL: #16125
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
243083df authored and targos committed Oct 18, 2017
1 parent 8452af2 commit a4bc6ff
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,9 @@ Module._findPath = function(request, paths, isMain) {
if (!filename && rc === 1) { // Directory.
if (exts === undefined)
exts = Object.keys(Module._extensions);
filename = tryPackage(basePath, exts, isMain);
}

if (!filename && rc === 1) { // Directory.
// try it with each of the extensions at "index"
if (exts === undefined)
exts = Object.keys(Module._extensions);
filename = tryExtensions(path.resolve(basePath, 'index'), exts, isMain);
filename = tryPackage(basePath, exts, isMain) ||
// try it with each of the extensions at "index"
tryExtensions(path.resolve(basePath, 'index'), exts, isMain);
}

if (filename) {
Expand Down

0 comments on commit a4bc6ff

Please sign in to comment.