Skip to content

Commit 99ecf12

Browse files
committed
Revert "fix/add-error-message-for-other-module-not-found (#8)"
This reverts commit e95ca30.
1 parent b0e8506 commit 99ecf12

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

index.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,14 @@ module.exports = {
2424
// Similar to native `require` behavior, but doesn't check in `node_modules` folders
2525
// Based on https://github.com/js-cli/node-findup-sync
2626
function requireUp(filename, cwd) {
27-
var filepath = path.resolve(cwd, filename) + exts[i];
27+
var filepath = path.resolve(cwd, filename);
2828

2929
for (var i = 0; i < exts.length; i++) {
3030
try {
31-
return require(filepath);
31+
return require(filepath + exts[i]);
3232
} catch(error) {
33-
var filepathNotFound = error.code === 'MODULE_NOT_FOUND' &&
34-
error.message.includes(`Cannot find module '${filepath}'`);
35-
36-
// Rethrow unless error is just saying `filepath` not found (in that case,
37-
// let next loop check parent directory instead).
38-
if (!filepathNotFound) {
33+
// Ignore OS errors (will recurse to parent directory)
34+
if (error.code !== 'MODULE_NOT_FOUND') {
3935
throw error;
4036
}
4137
}

0 commit comments

Comments
 (0)