Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ForsakenHarmony committed Jan 30, 2023
1 parent 3db1d52 commit 469b938
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/next-core/src/next_server/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,16 @@ impl ResolvePlugin for ExternalCjsModulesResolvePlugin {
fs_path: FileSystemPathVc,
_request: RequestVc,
) -> Result<ResolveResultOptionVc> {
let raw_fs_path = &*fs_path.await?;

// always bundle transpiled modules
let transpiled_glob = packages_glob(self.transpiled_packages).await?;
if transpiled_glob.execute(&fs_path.await?.path) {
if transpiled_glob.execute(&raw_fs_path.path) {
return Ok(ResolveResultOptionVc::none());
}

// mjs -> esm module
if Some("mjs") == raw_fs_path.extension() {
return Ok(ResolveResultOptionVc::none());
}

Expand Down
1 change: 1 addition & 0 deletions crates/turbopack-core/src/resolve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ impl ResolveResult {
list.extend(list2.iter().cloned());
}
_ => {
list.extend(other.get_references().iter().cloned());
*self = ResolveResult::Unresolveable(take(list));
}
},
Expand Down

0 comments on commit 469b938

Please sign in to comment.