Skip to content

Commit

Permalink
use the first result when resolving extends in tsconfig.json (vercel#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra authored Jan 13, 2023
1 parent 21874f0 commit aa7cf5a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/turbopack-ecmascript/src/typescript/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use turbopack_core::{
origin::ResolveOriginVc,
parse::{Request, RequestVc},
pattern::QueryMapVc,
resolve, AliasPattern, ResolveResult, ResolveResultVc,
resolve, AliasPattern, ResolveResultVc,
},
source_asset::SourceAssetVc,
};
Expand Down Expand Up @@ -72,8 +72,12 @@ pub async fn read_tsconfigs(
RequestVc::parse(Value::new(extends.to_string().into())),
resolve_options,
)
.primary_assets()
.await?;
if let ResolveResult::Single(asset, _) = *result {
// There might be multiple alternatives like
// "some/path/node_modules/xyz/abc.json" and "some/node_modules/xyz/abc.json".
// We only want to use the first one.
if let Some(&asset) = result.iter().next() {
data = asset.content().parse_json_with_comments();
tsconfig = asset;
} else {
Expand Down

0 comments on commit aa7cf5a

Please sign in to comment.