@@ -1118,7 +1118,7 @@ namespace ts {
1118
1118
const perModuleNameCache = cache && cache . getOrCreateCacheForModuleName ( moduleName ) ;
1119
1119
return forEachAncestorDirectory ( normalizeSlashes ( directory ) , ancestorDirectory => {
1120
1120
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 ) ;
1122
1122
if ( resolutionFromCache ) {
1123
1123
return resolutionFromCache ;
1124
1124
}
@@ -1196,12 +1196,13 @@ namespace ts {
1196
1196
typesPackageName ;
1197
1197
}
1198
1198
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 > {
1200
1200
const result = cache && cache . get ( containingDirectory ) ;
1201
1201
if ( result ) {
1202
1202
if ( traceEnabled ) {
1203
1203
trace ( host , Diagnostics . Resolution_for_module_0_was_found_in_cache_from_location_1 , moduleName , containingDirectory ) ;
1204
1204
}
1205
+ failedLookupLocations . push ( ...result . failedLookupLocations ) ;
1205
1206
return { value : result . resolvedModule && { path : result . resolvedModule . resolvedFileName , extension : result . resolvedModule . extension , packageId : result . resolvedModule . packageId } } ;
1206
1207
}
1207
1208
}
@@ -1226,7 +1227,7 @@ namespace ts {
1226
1227
if ( ! isExternalModuleNameRelative ( moduleName ) ) {
1227
1228
// Climb up parent directories looking for a module.
1228
1229
const resolved = forEachAncestorDirectory ( containingDirectory , directory => {
1229
- const resolutionFromCache = tryFindNonRelativeModuleNameInCache ( perModuleNameCache , moduleName , directory , traceEnabled , host ) ;
1230
+ const resolutionFromCache = tryFindNonRelativeModuleNameInCache ( perModuleNameCache , moduleName , directory , traceEnabled , host , failedLookupLocations ) ;
1230
1231
if ( resolutionFromCache ) {
1231
1232
return resolutionFromCache ;
1232
1233
}
0 commit comments