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: support sloppy resolution to file where directory exists #22800

Merged
merged 1 commit into from Mar 8, 2024

Conversation

lucacasonato
Copy link
Member

Previously the sloppy resolver could not resolve the following:

  • foo/bar.ts
  • foo.ts
  • index.ts

Where index.ts contains import "./foo", because it did not consider foo.ts a valid target for this directory import.

This commit fixes this bug.

Previously the sloppy resolver could not resolve the following:

- foo/bar.ts
- foo.ts
- index.ts

Where `index.ts` contains `import "./foo"`, because it did not consider `foo.ts` a valid target for this directory import.

This commit fixes this bug.
Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

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

LGTM!

probe_paths.push((
path.join("index.jsx"),
SloppyImportsResolutionReason::Directory,
));
Copy link
Member

Choose a reason for hiding this comment

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

We should probably eventually switch this to an iterator.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup - this could all use a cleanup I agree

@lucacasonato lucacasonato enabled auto-merge (squash) March 8, 2024 16:31
@lucacasonato lucacasonato merged commit 5d671e0 into main Mar 8, 2024
17 checks passed
@lucacasonato lucacasonato deleted the trpc_sloppy_imports_fix branch March 8, 2024 17:25
nathanwhit pushed a commit that referenced this pull request Mar 14, 2024
Previously the sloppy resolver could not resolve the following:

- foo/bar.ts
- foo.ts
- index.ts

Where `index.ts` contains `import "./foo"`, because it did not consider
`foo.ts` a valid target for this directory import.

This commit fixes this bug.
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.

None yet

3 participants