From dcbd4c567d19a18da67a097eed8e34227389561c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Mon, 6 Jan 2020 21:55:34 +0100 Subject: [PATCH] [Fix] `sync`/`async`: Fixes isCore check --- 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 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;