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 <t-weswig@microsoft.com>
This commit is contained in:
TypeScript Bot
2021-10-05 17:42:01 -07:00
committed by GitHub
co-authored by Wesley Wigham
parent bbb31bb109
commit 34988fd49e
+1 -1
View File
@@ -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) {