File tree 1 file changed +4
-8
lines changed
1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -24,18 +24,14 @@ module.exports = {
24
24
// Similar to native `require` behavior, but doesn't check in `node_modules` folders
25
25
// Based on https://github.com/js-cli/node-findup-sync
26
26
function requireUp ( filename , cwd ) {
27
- var filepath = path . resolve ( cwd , filename ) + exts [ i ] ;
27
+ var filepath = path . resolve ( cwd , filename ) ;
28
28
29
29
for ( var i = 0 ; i < exts . length ; i ++ ) {
30
30
try {
31
- return require ( filepath ) ;
31
+ return require ( filepath + exts [ i ] ) ;
32
32
} 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' ) {
39
35
throw error ;
40
36
}
41
37
}
You can’t perform that action at this time.
0 commit comments