diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 85ab3ab1443ded..8a4974225049ce 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -153,13 +153,12 @@ function readPackage(requestPath) { } try { - var pkg = packageMainCache[requestPath] = JSON.parse(json).main; + return packageMainCache[requestPath] = JSON.parse(json).main; } catch (e) { e.path = jsonPath; e.message = 'Error parsing ' + jsonPath + ': ' + e.message; throw e; } - return pkg; } function tryPackage(requestPath, exts, isMain) {