Skip to content

Custom vite resolver#881

Merged
duaneatat merged 4 commits into
ts-take-2from
duane/custom-vite-resolver
May 24, 2022
Merged

Custom vite resolver#881
duaneatat merged 4 commits into
ts-take-2from
duane/custom-vite-resolver

Conversation

@duaneatat
Copy link
Copy Markdown
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
Copy Markdown

@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
Copy Markdown
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.

2 participants