File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -1021,17 +1021,20 @@ impl<Fs: FileSystem> ResolverGeneric<Fs> {
10211021 let new_specifier = if tail. is_empty ( ) {
10221022 Cow :: Borrowed ( alias_value)
10231023 } else {
1024- let alias_value = Path :: new ( alias_value) . normalize ( ) ;
1024+ let alias_path = Path :: new ( alias_value) . normalize ( ) ;
10251025 // Must not append anything to alias_value if it is a file.
1026- let alias_value_cached_path = self . cache . value ( & alias_value ) ;
1027- if alias_value_cached_path . is_file ( & self . cache . fs , ctx) {
1026+ let cached_alias_path = self . cache . value ( & alias_path ) ;
1027+ if cached_alias_path . is_file ( & self . cache . fs , ctx) {
10281028 return Ok ( None ) ;
10291029 }
1030-
10311030 // Remove the leading slash so the final path is concatenated.
10321031 let tail = tail. trim_start_matches ( SLASH_START ) ;
1033- let normalized = alias_value_cached_path. normalize_with ( tail, & self . cache ) ;
1034- Cow :: Owned ( normalized. path ( ) . to_string_lossy ( ) . to_string ( ) )
1032+ if tail. is_empty ( ) {
1033+ Cow :: Borrowed ( alias_value)
1034+ } else {
1035+ let normalized = alias_path. normalize_with ( tail) ;
1036+ Cow :: Owned ( normalized. to_string_lossy ( ) . to_string ( ) )
1037+ }
10351038 } ;
10361039
10371040 * should_stop = true ;
Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ fn alias() {
8282 ( "should resolve '#' alias 2" , "#/index" , "/c/dir/index" ) ,
8383 ( "should resolve '@' alias 1" , "@" , "/c/dir/index" ) ,
8484 ( "should resolve '@' alias 2" , "@/index" , "/c/dir/index" ) ,
85+ ( "should resolve '@' alias 3" , "@/" , "/c/dir/index" ) ,
8586 ( "should resolve a recursive aliased module 1" , "recursive" , "/recursive/dir/index" ) ,
8687 ( "should resolve a recursive aliased module 2" , "recursive/index" , "/recursive/dir/index" ) ,
8788 ( "should resolve a recursive aliased module 3" , "recursive/dir" , "/recursive/dir/index" ) ,
You can’t perform that action at this time.
0 commit comments