This repository was archived by the owner on Sep 16, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-18
lines changed Expand file tree Collapse file tree 1 file changed +15
-18
lines changed Original file line number Diff line number Diff line change @@ -37,24 +37,21 @@ export default class ModuleCache extends MapCache {
3737 }
3838
3939 static resolve ( id , from = process . cwd ( ) ) {
40- try {
41- const dirs = path . dirname ( Module . _resolveFilename ( id , _ . assign ( new Module , {
42- 'paths' : Module . _nodeModulePaths ( from )
43- } ) ) ) . split ( path . sep ) ;
44-
45- let { length } = dirs ;
46- while ( length -- ) {
47- const dirSub = dirs . slice ( 0 , length + 1 ) ;
48- const dirPath = dirSub . join ( '/' ) ;
49- const pkgPath = path . join ( dirPath , 'package.json' ) ;
50-
51- if ( ( length && dirs [ length - 1 ] == 'node_modules' ) ||
52- ( fs . existsSync ( pkgPath ) && require ( pkgPath ) . name == id ) ) {
53- return dirPath ;
54- }
40+ const dirs = path . dirname ( Module . _resolveFilename ( id , _ . assign ( new Module , {
41+ 'paths' : Module . _nodeModulePaths ( from )
42+ } ) ) ) . split ( path . sep ) ;
43+
44+ let { length } = dirs ;
45+ while ( length -- ) {
46+ const dirSub = dirs . slice ( 0 , length + 1 ) ;
47+ const dirPath = dirSub . join ( '/' ) ;
48+ const pkgPath = path . join ( dirPath , 'package.json' ) ;
49+
50+ if ( ( length && dirs [ length - 1 ] == 'node_modules' ) ||
51+ ( fs . existsSync ( pkgPath ) && require ( pkgPath ) . name == id ) ) {
52+ return dirPath ;
5553 }
56- return dirs . join ( '/' ) ;
57- } catch ( e ) { }
58- return '' ;
54+ }
55+ return dirs . join ( '/' ) ;
5956 }
6057} ;
You can’t perform that action at this time.
0 commit comments