Limit package.json realpath lookup to only successful resolutions (#46209)

This commit is contained in:
Wesley Wigham 2021-10-05 10:24:08 -07:00 committed by GitHub
parent d60747f043
commit a0cf126513
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -874,7 +874,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) {