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

Custom vite resolver #881

Merged
merged 4 commits into from May 24, 2022
Merged

Custom vite resolver #881

merged 4 commits into from May 24, 2022

Conversation

duaneatat
Copy link
Contributor

Resolves #880 (comment)

This makes it so we can use "js" extensions for TypeScript imports by adding a custom resolver for Vite (which was the only piece that wasn't happy with the js extensions for files that don't exist. This custom loader won't be necessary once all of the files are TypeScript, since Vite implemented the typescript fallback for when importing from a typescript file..

With this change, I'm able to successfully run yarn test, yarn dev, as well as import Plot as an ESM into another project.

@duaneatat duaneatat requested a review from mythmon May 24, 2022 21:53
@duaneatat duaneatat mentioned this pull request May 24, 2022
4 tasks
Copy link

@mythmon mythmon left a comment

Choose a reason for hiding this comment

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

Ah, excellent. I was starting to look into having TS rewrite the imports, but that proved fruitless. This seems cleaner anyways.

@duaneatat
Copy link
Contributor Author

I was starting to look into having TS rewrite the imports, but that proved fruitless.

Yeah, the TypeScript folks have taken a position against doing this: microsoft/TypeScript#16577 😅

@duaneatat duaneatat merged commit b614e1a into ts-take-2 May 24, 2022
@duaneatat duaneatat deleted the duane/custom-vite-resolver branch May 24, 2022 22:08
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

2 participants