-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Should prefer relative path first before index when it comes to suggestions #47040
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
Comments
This is the intended behavior; shorter paths (those with fewer directory separators) are always preferred over longer ones. The motivation is that packages which re-export their contents are typically doing so to provide a unified API surface (meaning they don't want you to index into their subdirectories as shown here). |
@RyanCavanaugh makes sense. Is there a way to switch the order? I had seen an |
Not sure. @andrewbranch ? |
Duplicate of #45953. We’ll probably drop paths that resolve to nothing but dots and slashes as that often creates an import cycle between a barrel re-export and the file that’s importing it (which may not be a problem at runtime, but can be if the modules have side effects, and I’ve just never seen anyone use import paths like that on purpose). |
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Does this issue occur when all extensions are disabled?: Yes
Steps to Reproduce:
export * as baseSchemas from './baseSchemas'
Expectation is the relative should be preferred over the index. When importing or default to index, it can cause a circular dependency if index is imported, which then index imports the same file.
The text was updated successfully, but these errors were encountered: