@@ -1118,7 +1118,7 @@ namespace ts {
11181118 const perModuleNameCache = cache && cache . getOrCreateCacheForModuleName ( moduleName ) ;
11191119 return forEachAncestorDirectory ( normalizeSlashes ( directory ) , ancestorDirectory => {
11201120 if ( getBaseFileName ( ancestorDirectory ) !== "node_modules" ) {
1121- const resolutionFromCache = tryFindNonRelativeModuleNameInCache ( perModuleNameCache , moduleName , ancestorDirectory , state . traceEnabled , state . host ) ;
1121+ const resolutionFromCache = tryFindNonRelativeModuleNameInCache ( perModuleNameCache , moduleName , ancestorDirectory , state . traceEnabled , state . host , failedLookupLocations ) ;
11221122 if ( resolutionFromCache ) {
11231123 return resolutionFromCache ;
11241124 }
@@ -1196,12 +1196,13 @@ namespace ts {
11961196 typesPackageName ;
11971197 }
11981198
1199- function tryFindNonRelativeModuleNameInCache ( cache : PerModuleNameCache | undefined , moduleName : string , containingDirectory : string , traceEnabled : boolean , host : ModuleResolutionHost ) : SearchResult < Resolved > {
1199+ function tryFindNonRelativeModuleNameInCache ( cache : PerModuleNameCache | undefined , moduleName : string , containingDirectory : string , traceEnabled : boolean , host : ModuleResolutionHost , failedLookupLocations : Push < string > ) : SearchResult < Resolved > {
12001200 const result = cache && cache . get ( containingDirectory ) ;
12011201 if ( result ) {
12021202 if ( traceEnabled ) {
12031203 trace ( host , Diagnostics . Resolution_for_module_0_was_found_in_cache_from_location_1 , moduleName , containingDirectory ) ;
12041204 }
1205+ failedLookupLocations . push ( ...result . failedLookupLocations ) ;
12051206 return { value : result . resolvedModule && { path : result . resolvedModule . resolvedFileName , extension : result . resolvedModule . extension , packageId : result . resolvedModule . packageId } } ;
12061207 }
12071208 }
@@ -1226,7 +1227,7 @@ namespace ts {
12261227 if ( ! isExternalModuleNameRelative ( moduleName ) ) {
12271228 // Climb up parent directories looking for a module.
12281229 const resolved = forEachAncestorDirectory ( containingDirectory , directory => {
1229- const resolutionFromCache = tryFindNonRelativeModuleNameInCache ( perModuleNameCache , moduleName , directory , traceEnabled , host ) ;
1230+ const resolutionFromCache = tryFindNonRelativeModuleNameInCache ( perModuleNameCache , moduleName , directory , traceEnabled , host , failedLookupLocations ) ;
12301231 if ( resolutionFromCache ) {
12311232 return resolutionFromCache ;
12321233 }
0 commit comments