Fix two module specifier ending preference detection issues (#53691)

This commit is contained in:
Andrew Branch authored and GitHub committed 2023-04-06 13:06:58 -07:00
1 parent 68d8be4f1d
commit 287ee41cf2
4 files changed
+52 -2

No files matched your search

+3 -1
View File
@@ -147,7 +147,9 @@ function getPreferences(
return [ModuleSpecifierEnding.JsExtension];
}
if (getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Classic) {
return [ModuleSpecifierEnding.Index, ModuleSpecifierEnding.JsExtension];
return preferredEnding === ModuleSpecifierEnding.JsExtension
? [ModuleSpecifierEnding.JsExtension, ModuleSpecifierEnding.Index]
: [ModuleSpecifierEnding.Index, ModuleSpecifierEnding.JsExtension];
}
switch (preferredEnding) {
case ModuleSpecifierEnding.JsExtension: return [ModuleSpecifierEnding.JsExtension, ModuleSpecifierEnding.Minimal, ModuleSpecifierEnding.Index];