Skip to content

Commit b261110

Browse files
arcanisljharb
authored andcommitted
[Fix] sync/async: Fixes isCore check (#206)
1 parent 2f0e047 commit b261110

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

lib/async.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ module.exports = function resolve(x, options, callback) {
8282
if ((/\/$/).test(x) && res === basedir) {
8383
loadAsDirectory(res, opts.package, onfile);
8484
} else loadAsFile(res, opts.package, onfile);
85+
} else if (isCore(x)) {
86+
return cb(null, x);
8587
} else loadNodeModules(x, basedir, function (err, n, pkg) {
8688
if (err) cb(err);
87-
else if (isCore(x)) return cb(null, x);
8889
else if (n) {
8990
return maybeUnwrapSymlink(n, opts, function (err, realN) {
9091
if (err) {

lib/sync.js

-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ module.exports = function (x, options) {
6969
if (n) return maybeUnwrapSymlink(n, opts);
7070
}
7171

72-
if (isCore(x)) return x;
73-
7472
var err = new Error("Cannot find module '" + x + "' from '" + parent + "'");
7573
err.code = 'MODULE_NOT_FOUND';
7674
throw err;

0 commit comments

Comments
 (0)