From 4d138d7e9d419bb981e7b72a1569fd4ff2b2108d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Sun, 5 Jan 2020 23:17:48 +0100 Subject: [PATCH] Fixes isCore bug --- lib/async.js | 3 ++- lib/sync.js | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/async.js b/lib/async.js index b2c8f948..9787db38 100644 --- a/lib/async.js +++ b/lib/async.js @@ -105,9 +105,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 ead466e1..cc0ec56c 100644 --- a/lib/sync.js +++ b/lib/sync.js @@ -84,8 +84,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;