Revert "TURBOPACK: Fix subpath imports resolving to dependencies"#151
Conversation
This reverts commit e3b7a69.
There was a problem hiding this comment.
Code Review
This pull request simplifies the resolution logic in turbopack-core by removing the ExportImport enum and its associated conditional logic in handle_exports_imports_field, which streamlines the request parsing process. Additionally, the dep-in-nm dependency and its corresponding test cases have been removed. Feedback was provided to optimize the code by removing an unnecessary .clone() call on result_path when constructing the Pattern::Concatenation vector, as the variable is not used subsequently.
| let request = *Request::parse(Pattern::Concatenation(vec![ | ||
| Pattern::Constant(rcstr!("./")), | ||
| result_path.clone(), | ||
| ])) | ||
| .to_resolved() | ||
| .await?; |
There was a problem hiding this comment.
The result_path variable is not used after being moved into the Pattern::Concatenation vector. Since it is an owned Pattern (returned by with_normalized_path), calling .clone() is unnecessary and incurs an extra allocation. You can move it directly.
let request = *Request::parse(Pattern::Concatenation(vec![
Pattern::Constant(rcstr!("./")),
result_path,
]))
.to_resolved()
.await?;
Reverts #150
Upstream has merged