Skip to content

Commit

Permalink
Turbopack: Support resolving to index.js with fully_specified (vercel…
Browse files Browse the repository at this point in the history
…#71367)

Closes PACK-3303 

`next-mdx-remote` has no `main` field, only the fallback
`next-mdx-remote/index.js` entry.
This failed when using `fully_specified: true` because internally
- `resolve_module_request("next-md-remote", "")` calls
- `resolve_into_package(".../node_modules/next-mdx-remote")` calls
- `resolve_into_folder(".../node_modules/next-mdx-remote")`.

This codepath via `resolve_into_package` should work however even when
`fully_specified`, as `await import("next-mdx-remote")` is also allowed
by Node.js.
  • Loading branch information
mischnic authored Oct 17, 2024
1 parent cad01db commit 06b6faa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion turbopack/crates/turbopack-core/src/resolve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2485,7 +2485,10 @@ async fn resolve_into_package(

// apply main field(s) or fallback to index.js if there's no subpath
if is_root_match {
results.push(resolve_into_folder(package_path, options));
results.push(resolve_into_folder(
package_path,
options.with_fully_specified(false),
));
}

if could_match_others {
Expand Down

0 comments on commit 06b6faa

Please sign in to comment.