@@ -69,6 +69,8 @@ import {
69
69
startsWith ,
70
70
stringContains ,
71
71
StringLiteralLike ,
72
+ supportedJSExtensionsFlat ,
73
+ supportedTSImplementationExtensions ,
72
74
trace ,
73
75
updateResolutionField ,
74
76
WatchDirectoryFlags ,
@@ -298,13 +300,6 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
298
300
moduleResolutionCache . getPackageJsonInfoCache ( ) ,
299
301
) ;
300
302
301
- /**
302
- * These are the extensions that failed lookup files will have by default,
303
- * any other extension of failed lookup will be store that path in custom failed lookup path
304
- * This helps in not having to comb through all resolutions when files are added/removed
305
- * Note that .d.ts file also has .d.ts extension hence will be part of default extensions
306
- */
307
- const failedLookupDefaultExtensions = [ Extension . Ts , Extension . Tsx , Extension . Js , Extension . Jsx , Extension . Json ] ;
308
303
const customFailedLookupPaths = new Map < string , number > ( ) ;
309
304
310
305
const directoryWatchesOfFailedLookups = new Map < string , DirectoryWatchesOfFailedLookup > ( ) ;
@@ -764,7 +759,15 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
764
759
}
765
760
766
761
function isPathWithDefaultFailedLookupExtension ( path : Path ) {
767
- return fileExtensionIsOneOf ( path , failedLookupDefaultExtensions ) ;
762
+ /**
763
+ * These are the extensions that failed lookup files will have by default,
764
+ * any other extension of failed lookup will be store that path in custom failed lookup path
765
+ * This helps in not having to comb through all resolutions when files are added/removed
766
+ * Note that .d.ts file also has .d.ts extension hence will be part of default extensions
767
+ */
768
+ return fileExtensionIsOneOf ( path , supportedTSImplementationExtensions ) ||
769
+ fileExtensionIsOneOf ( path , supportedJSExtensionsFlat ) ||
770
+ fileExtensionIs ( path , Extension . Json ) ;
768
771
}
769
772
770
773
function watchFailedLookupLocationsOfExternalModuleResolutions < T extends ResolutionWithFailedLookupLocations , R extends ResolutionWithResolvedFileName > (
0 commit comments