@@ -341,7 +341,7 @@ impl<C: Cache<Cp = FsCachedPath>> ResolverGeneric<C> {
341341 Some ( Component :: RootDir | Component :: Prefix ( _) ) => {
342342 self . require_absolute ( cached_path, specifier, ctx)
343343 }
344- // 3. If X begins with './' or '/' or '../'
344+ // 3. If X is '.' or begins with './' or '/' or '../'
345345 Some ( Component :: CurDir | Component :: ParentDir ) => {
346346 self . require_relative ( cached_path, specifier, ctx)
347347 }
@@ -420,7 +420,7 @@ impl<C: Cache<Cp = FsCachedPath>> ResolverGeneric<C> {
420420 Err ( ResolveError :: NotFound ( specifier. to_string ( ) ) )
421421 }
422422
423- // 3. If X begins with './' or '/' or '../'
423+ // 3. If X is '.' or begins with './' or '/' or '../'
424424 fn require_relative (
425425 & self ,
426426 cached_path : & C :: Cp ,
@@ -435,6 +435,12 @@ impl<C: Cache<Cp = FsCachedPath>> ResolverGeneric<C> {
435435 let cached_path = cached_path. normalize_with ( specifier, self . cache . as_ref ( ) ) ;
436436 // a. LOAD_AS_FILE(Y + X)
437437 // b. LOAD_AS_DIRECTORY(Y + X)
438+ if specifier == "." || specifier == "./" {
439+ let cached_path = cached_path. normalize_with ( "../index.js" , self . cache . as_ref ( ) ) ;
440+ if let Some ( path) = self . load_as_file ( & cached_path, ctx) ? {
441+ return Ok ( path) ;
442+ }
443+ }
438444 if let Some ( path) = self . load_as_file_or_directory ( & cached_path, specifier, ctx) ? {
439445 return Ok ( path) ;
440446 }
@@ -1353,7 +1359,7 @@ impl<C: Cache<Cp = FsCachedPath>> ResolverGeneric<C> {
13531359 let paths = tsconfig. resolve ( cached_path. path ( ) , specifier) ;
13541360 for path in paths {
13551361 let cached_path = self . cache . value ( & path) ;
1356- if let Ok ( path) = self . require_relative ( & cached_path, "." , ctx) {
1362+ if let Some ( path) = self . load_as_file_or_directory ( & cached_path, "." , ctx) ? {
13571363 return Ok ( Some ( path) ) ;
13581364 }
13591365 }
0 commit comments