From cb27c2bd3ea5cc61e5eba7c6a43a49d3914dfdd1 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Mon, 20 Jan 2020 20:55:45 +0200 Subject: [PATCH] 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 Reviewed-By: Shelley Vohr Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott --- lib/internal/modules/cjs/loader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index b3ead06dc3afab..a1b3270b0919ec 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -432,7 +432,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;