Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(node): show directory import and missing extension suggestions #27905

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dsherret
Copy link
Member

@dsherret dsherret commented Feb 1, 2025

Shows directory import and missing extension suggestions in error messages similar but not exactly to node.

@@ -143,6 +144,39 @@ impl NodeResolution {
}
}

struct LocalPath {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming is hard.

}
}
LocalUrlOrPath::Path(LocalPath { path, known_exists }) => {
if known_exists {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As part of this change, we do the finalize_resolution step when resolving npm specifiers too (so that these better errors can happen and so the node resolution code is always using the same path). I was concerened about the extra fs hit that brings, so I updated the code to also keep track of whether we know a path exists in order to avoid the finalization check if the path is known to exist.

@Hajime-san
Copy link
Contributor

Would it be okay to close the below PR due to this?

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, very useful hint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants