module: fix check exports issue in cjs module loading

Refs: https://github.com/nodejs/node/pull/31001#issuecomment-576353389

PR-URL: https://github.com/nodejs/node/pull/31427
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Guy Bedford authored and Rich Trott committed 2020-01-20 21:32:52 -08:00
1 parent 343ddffc1c
commit c2c3274631
1 file changed
+1 -1
+1 -1
View File
@@ -435,7 +435,7 @@ function resolveBasePath(basePath, exts, isMain, trailingSlash, request) {
function trySelf(parentPath, isMain, request) {
const { data: pkg, path: basePath } = readPackageScope(parentPath) || {};
if (!pkg || 'exports' in pkg === false) return false;
if (!pkg || pkg.exports === undefined) return false;
if (typeof pkg.name !== 'string') return false;
let expansion;