Browse Source

module: minor performance improvement

PR-URL: https://github.com/nodejs/node/pull/16125
Reviewed-By: Anna Henningsen <anna@addaleax.net>
v9.x-staging
243083df 7 years ago
committed by Anna Henningsen
parent
commit
695b307cc6
No known key found for this signature in database GPG Key ID: 9C63F3A6CD2AD8F9
  1. 11
      lib/module.js

11
lib/module.js

@ -218,14 +218,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) {

Loading…
Cancel
Save