@@ -208,6 +208,11 @@ func getAllModulePathsWorker(
208208 allFileNames [p .FileName ] = p
209209 }
210210
211+ useCaseSensitiveFileNames := info .UseCaseSensitiveFileNames
212+ comparePaths := func (a , b ModulePath ) int {
213+ return comparePathsByRedirect (a , b , useCaseSensitiveFileNames )
214+ }
215+
211216 // Sort by paths closest to importing file Name directory
212217 sortedPaths := make ([]ModulePath , 0 , len (paths ))
213218 for directory := info .SourceDirectory ; len (allFileNames ) != 0 ; {
@@ -220,7 +225,7 @@ func getAllModulePathsWorker(
220225 }
221226 }
222227 if len (pathsInDirectory ) > 0 {
223- slices .SortStableFunc (pathsInDirectory , comparePathsByRedirectAndNumberOfDirectorySeparators )
228+ slices .SortFunc (pathsInDirectory , comparePaths )
224229 sortedPaths = append (sortedPaths , pathsInDirectory ... )
225230 }
226231 newDirectory := tspath .GetDirectoryPath (directory )
@@ -231,7 +236,7 @@ func getAllModulePathsWorker(
231236 }
232237 if len (allFileNames ) > 0 {
233238 remainingPaths := slices .Collect (maps .Values (allFileNames ))
234- slices .SortStableFunc (remainingPaths , comparePathsByRedirectAndNumberOfDirectorySeparators )
239+ slices .SortFunc (remainingPaths , comparePaths )
235240 sortedPaths = append (sortedPaths , remainingPaths ... )
236241 }
237242 return sortedPaths
0 commit comments