diff --git a/lib/async.js b/lib/async.js index 896a7789..cf8c24b5 100644 --- a/lib/async.js +++ b/lib/async.js @@ -96,9 +96,10 @@ module.exports = function resolve(x, options, callback) { if ((/\/$/).test(x) && res === basedir) { loadAsDirectory(res, opts.package, onfile); } else loadAsFile(res, opts.package, onfile); + } else if (isCore(x)) { + return cb(null, x); } else loadNodeModules(x, basedir, function (err, n, pkg) { if (err) cb(err); - else if (isCore(x)) return cb(null, x); else if (n) { return maybeUnwrapSymlink(n, opts, function (err, realN) { if (err) { diff --git a/lib/sync.js b/lib/sync.js index 7059eef7..79633997 100644 --- a/lib/sync.js +++ b/lib/sync.js @@ -75,8 +75,6 @@ module.exports = function (x, options) { if (n) return maybeUnwrapSymlink(n, opts); } - if (isCore(x)) return x; - var err = new Error("Cannot find module '" + x + "' from '" + parent + "'"); err.code = 'MODULE_NOT_FOUND'; throw err;