Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce syscalls on require() #1920

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/module.js
Expand Up @@ -129,7 +129,7 @@ const noopDeprecateRequireDot = util.deprecate(function() {},
Module._findPath = function(request, paths) {
var exts = Object.keys(Module._extensions);

if (request.charAt(0) === '/') {
if (path.isAbsolute(request)) {
paths = [''];
}

Expand All @@ -142,6 +142,8 @@ Module._findPath = function(request, paths) {

// For each path
for (var i = 0, PL = paths.length; i < PL; i++) {
// Don't search further if path doesn't exist
if (paths[i] && internalModuleStat(paths[i]) < 1) continue;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that one needs the path._makeLong fix (#1991) ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, yes, I think so. PR: #2011

var basePath = path.resolve(paths[i], request);
var filename;

Expand Down