File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -671,11 +671,14 @@ impl<Fs: FileSystem> ResolverGeneric<Fs> {
671
671
}
672
672
}
673
673
// enhanced-resolve: try file as alias
674
- let alias_specifier = cached_path. path ( ) . to_string_lossy ( ) ;
675
- if let Some ( path) =
676
- self . load_alias ( cached_path, & alias_specifier, & self . options . alias , ctx) ?
677
- {
678
- return Ok ( Some ( path) ) ;
674
+ // Guard this because this is on a hot path, and `.to_string_lossy()` has a cost.
675
+ if !self . options . alias . is_empty ( ) {
676
+ let alias_specifier = cached_path. path ( ) . to_string_lossy ( ) ;
677
+ if let Some ( path) =
678
+ self . load_alias ( cached_path, & alias_specifier, & self . options . alias , ctx) ?
679
+ {
680
+ return Ok ( Some ( path) ) ;
681
+ }
679
682
}
680
683
if cached_path. is_file ( & self . cache . fs , ctx) {
681
684
return Ok ( Some ( cached_path. clone ( ) ) ) ;
You can’t perform that action at this time.
0 commit comments