mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
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:
1 parent
343ddffc1c
commit
c2c3274631
1 file changed
+1
-1
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user