File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff 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 
2626function  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    } 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments