Skip to content

Commit dcbd4c5

Browse files
arcanisljharb
authored andcommitted
[Fix] sync/async: Fixes isCore check
1 parent 6f57476 commit dcbd4c5

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

lib/async.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,10 @@ module.exports = function resolve(x, options, callback) {
9696
if ((/\/$/).test(x) && res === basedir) {
9797
loadAsDirectory(res, opts.package, onfile);
9898
} else loadAsFile(res, opts.package, onfile);
99+
} else if (isCore(x)) {
100+
return cb(null, x);
99101
} else loadNodeModules(x, basedir, function (err, n, pkg) {
100102
if (err) cb(err);
101-
else if (isCore(x)) return cb(null, x);
102103
else if (n) {
103104
return maybeUnwrapSymlink(n, opts, function (err, realN) {
104105
if (err) {

lib/sync.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ module.exports = function (x, options) {
7575
if (n) return maybeUnwrapSymlink(n, opts);
7676
}
7777

78-
if (isCore(x)) return x;
79-
8078
var err = new Error("Cannot find module '" + x + "' from '" + parent + "'");
8179
err.code = 'MODULE_NOT_FOUND';
8280
throw err;

0 commit comments

Comments
 (0)