Skip to content

Commit 50e7859

Browse files
committed
Revert "module: fix check for package.json at volume root"
This reverts commit 51af89f. This has needed to be backed out of both the 14.5.0 and 14.6.0 releases due to creating regressions across multiple projects including: * coffeescript * JSONStream * gulp * and more We should reopen a PR to figure out how to land this in a way that is non-breaking. Refs: nodejs#33476
1 parent 128ed10 commit 50e7859

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/internal/modules/cjs/loader.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ const {
4949
SafeSet,
5050
String,
5151
StringPrototypeIndexOf,
52-
StringPrototypeLastIndexOf,
5352
StringPrototypeMatch,
5453
StringPrototypeSlice,
5554
StringPrototypeStartsWith,
@@ -310,13 +309,12 @@ function readPackageScope(checkPath) {
310309
const rootSeparatorIndex = checkPath.indexOf(path.sep);
311310
let separatorIndex;
312311
while (
313-
(separatorIndex = StringPrototypeLastIndexOf(checkPath, path.sep)) >=
314-
rootSeparatorIndex
312+
(separatorIndex = checkPath.lastIndexOf(path.sep)) > rootSeparatorIndex
315313
) {
316314
checkPath = checkPath.slice(0, separatorIndex);
317315
if (checkPath.endsWith(path.sep + 'node_modules'))
318316
return false;
319-
const pjson = readPackage(checkPath + path.sep);
317+
const pjson = readPackage(checkPath);
320318
if (pjson) return {
321319
path: checkPath,
322320
data: pjson

0 commit comments

Comments
 (0)