File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -48,17 +48,22 @@ export default class FileLoader {
4848 //get the absolute path
4949 pathname = path . resolve ( pwd , pathname ) ;
5050 }
51- //if the pathname does not start with /,
52- //the path should start with modules
53- if ( ! pathname . startsWith ( '/' ) && ! pathname . startsWith ( '\\' ) ) {
51+ //if the pathname is not already absolute,
52+ //the path should start with modules
53+ if ( ! path . isAbsolute ( pathname ) ) {
5454 let cwd = pwd ;
5555 do {
5656 const module = path . resolve ( cwd , 'node_modules' , pathname ) ;
5757 if ( this . _fs . existsSync ( module ) ) {
5858 return module ;
5959 }
60- cwd = path . dirname ( cwd ) ;
61- } while ( cwd !== '/' ) ;
60+ const parent = path . dirname ( cwd ) ;
61+ //stops at root dir (C:\ or /)
62+ if ( parent === cwd ) {
63+ break ;
64+ }
65+ cwd = parent ;
66+ } while ( true ) ;
6267 pathname = path . resolve ( this . modules ( this . _cwd ) , pathname ) ;
6368 }
6469 if ( exists && ! this . _fs . existsSync ( pathname ) ) {
You can’t perform that action at this time.
0 commit comments