From 624ed0eed4fc280fb647e443421cafc09e5f826f Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Mon, 20 Jan 2020 20:55:45 +0200 Subject: 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 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; -- cgit v1.2.1