From 34988fd49e0deca1adffd20046fa1af2077c6ee8 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Tue, 5 Oct 2021 17:42:01 -0700 Subject: [PATCH] Cherry-pick PR #46209 into release-4.4 (#46230) Component commits: 228679871a Limit package.json realpath lookup to only successful resolutions Co-authored-by: Wesley Wigham --- src/compiler/tsbuildPublic.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/tsbuildPublic.ts b/src/compiler/tsbuildPublic.ts index 5284be22787b2..2d02637c7ec49 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -873,7 +873,7 @@ namespace ts { ); state.lastCachedPackageJsonLookups.set(projectPath, state.moduleResolutionCache && map( state.moduleResolutionCache.getPackageJsonInfoCache().entries(), - ([path, data]) => ([state.host.realpath ? toPath(state, state.host.realpath(path)) : path, data] as const) + ([path, data]) => ([state.host.realpath && data ? toPath(state, state.host.realpath(path)) : path, data] as const) )); if (state.watch) {