@@ -362,9 +362,6 @@ namespace ts {
362
362
}
363
363
364
364
function getOrCreateCacheForModuleName ( nonRelativeModuleName : string ) : PerModuleNameCache {
365
- if ( isExternalModuleNameRelative ( nonRelativeModuleName ) ) {
366
- return undefined ! ; // TODO: GH#18217
367
- }
368
365
let perModuleNameCache = moduleNameToDirectoryMap . get ( nonRelativeModuleName ) ;
369
366
if ( ! perModuleNameCache ) {
370
367
perModuleNameCache = createPerModuleNameCache ( ) ;
@@ -492,10 +489,9 @@ namespace ts {
492
489
493
490
if ( perFolderCache ) {
494
491
perFolderCache . set ( moduleName , result ) ;
495
- // put result in per-module name cache
496
- const perModuleNameCache = cache ! . getOrCreateCacheForModuleName ( moduleName ) ;
497
- if ( perModuleNameCache ) {
498
- perModuleNameCache . set ( containingDirectory , result ) ;
492
+ if ( ! isExternalModuleNameRelative ( moduleName ) ) {
493
+ // put result in per-module name cache
494
+ cache ! . getOrCreateCacheForModuleName ( moduleName ) . set ( containingDirectory , result ) ;
499
495
}
500
496
}
501
497
}
@@ -1252,9 +1248,9 @@ namespace ts {
1252
1248
if ( resolvedUsingSettings ) {
1253
1249
return { value : resolvedUsingSettings } ;
1254
1250
}
1255
- const perModuleNameCache = cache && cache . getOrCreateCacheForModuleName ( moduleName ) ;
1256
1251
1257
1252
if ( ! isExternalModuleNameRelative ( moduleName ) ) {
1253
+ const perModuleNameCache = cache && cache . getOrCreateCacheForModuleName ( moduleName ) ;
1258
1254
// Climb up parent directories looking for a module.
1259
1255
const resolved = forEachAncestorDirectory ( containingDirectory , directory => {
1260
1256
const resolutionFromCache = tryFindNonRelativeModuleNameInCache ( perModuleNameCache , moduleName , directory , traceEnabled , host , failedLookupLocations ) ;
0 commit comments