summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Bedford <guybedford@gmail.com>2020-01-20 20:55:45 +0200
committerBeth Griggs <Bethany.Griggs@uk.ibm.com>2020-02-06 02:49:37 +0000
commit624ed0eed4fc280fb647e443421cafc09e5f826f (patch)
tree86115e2157d104220bf652a9395fb35c401670d7
parent60490f441a65cddf137998b9f9a381bbf4aefb04 (diff)
downloadnode-new-624ed0eed4fc280fb647e443421cafc09e5f826f.tar.gz
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>
-rw-r--r--lib/internal/modules/cjs/loader.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
index e552b8e4fd..f3d97781e2 100644
--- a/lib/internal/modules/cjs/loader.js
+++ b/lib/internal/modules/cjs/loader.js
@@ -433,7 +433,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;