Skip to content

Commit

Permalink
Fix missing failed lookup locations when resolving bare-specifier pac…
Browse files Browse the repository at this point in the history
…kage.json `"imports"` (#60924)
  • Loading branch information
andrewbranch authored Jan 23, 2025
1 parent 51d9a98 commit 329387d
Show file tree
Hide file tree
Showing 3 changed files with 462 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/compiler/moduleNameResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2756,6 +2756,11 @@ function getLoadModuleFromTargetExportOrImport(extensions: Extensions, state: Mo
traceIfEnabled(state, Diagnostics.Using_0_subpath_1_with_target_2, "imports", key, combinedLookup);
traceIfEnabled(state, Diagnostics.Resolving_module_0_from_1, combinedLookup, scope.packageDirectory + "/");
const result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, extensions, /*isConfigLookup*/ false, redirectedReference, state.conditions);
// Note: we cannot safely reassign `state.failedLookupLocations` during a request;
// `nodeModuleNameResolverWorker` relies on the `state` property remaining reference-equal
// to the one it initializes.
state.failedLookupLocations?.push(...result.failedLookupLocations ?? emptyArray);
state.affectingLocations?.push(...result.affectingLocations ?? emptyArray);
return toSearchResult(
result.resolvedModule ? {
path: result.resolvedModule.resolvedFileName,
Expand Down
Loading

0 comments on commit 329387d

Please sign in to comment.