-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Could not resolve
error on .js
extension in import with TypeScript
#5539
Comments
looks like a duplicate of #3040 |
Thanks for the search. I tried to find, but was not luck. |
Should we improve Vite’s TS docs with the solution for this case? |
should not be necessary as the issue got fixed with #5510 which will be in the next 2.7 beta |
Great to see! |
Thanks for the very fast response and taking care of tiny DX problems ❤ |
your welcome. thanks for making a good issue description, reproduction etc. |
Describe the bug
Short
If a TypeScript file has
index.js
in import, Vite will not find a file.Long
index.js
. Justimport '../dir/'
will not work..js
extensionimport '../dir/index.js'
even if source have.ts
extension because TS is compiler and technically, it will be.js
in the end (if I understand TS correctly).import '../dir/'
→import '../dir/index.js'
migrate broke Vite with an error:Changing
import '../dir/index.js''
→import '../dir/
(or toimport '../dir/index
) will break native ESM in universal Node/browser packages inside my monorepo.Reproduction
Reproduction
System Info
Used Package Manager
yarn
Logs
Validations
The text was updated successfully, but these errors were encountered: