From c2c3274631fe50b7e7e8949f453e01a38f5a3695 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 01d96a4a784397..ed0f201bdb2de7 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -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;