@@ -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 ,
@@ -622,7 +622,12 @@ impl<C: Cache<Cp = FsCachedPath>> ResolverGeneric<C> {
622622 if self . options . resolve_to_context {
623623 return Ok ( self . cache . is_dir ( cached_path, ctx) . then ( || cached_path. clone ( ) ) ) ;
624624 }
625- if !specifier. ends_with ( '/' ) {
625+ let is_dot_slash = specifier == "./" ;
626+ if is_dot_slash || !specifier. ends_with ( '/' ) {
627+ if is_dot_slash || specifier == "." {
628+ let cached_path = & cached_path. normalize_with ( "../index.js" , self . cache . as_ref ( ) ) ;
629+ return self . load_alias_or_file ( cached_path, ctx) ;
630+ }
626631 if let Some ( path) = self . load_as_file ( cached_path, ctx) ? {
627632 return Ok ( Some ( path) ) ;
628633 }
0 commit comments