-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
import
statements within vitest.workspace
can't import .ts
files using the .js
extension
#6519
Comments
I thought this is same as #5999, but it seems a bit different. Can you provide a reproduction? Maybe related to your |
Hello @sxxov. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with |
this issue is specific to & notably it's also as requested, i've also edited the issue to include the stackblitz link forked from the default vitest template, with the two files above (without touching anything else, i.e. using the provided hope this helps! |
Thanks for the repro. I thought the issue might be tsconfig |
It looks like this inconsistency is happening because Vitest is processing Here is a repro with just Vite showing the difference of Not sure if this is something we can fix, but putting a bug label for now. |
Digging this further, I found that Vite's import analysis (which replaces import of .js with .ts) is not happening since they also need Interestingly this is not the case in Vite 6 since it can grab |
Can't we just move Vitest's |
Describe the bug
thank you vitest team for this awesome project! i can't be happier leaving jest in the dust.
when using an
import
statment invitest.workspace.ts
, i can't import.ts
files using the.js
extension.changing the extension to use
.ts
or removing the extension completely, makes the import succeed.perculiarly, this seems to only fail if the import is inside the
vitest.workspace.ts
file, any further.js
imports that exist within the imported modules will import successfully.Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-t6tqec?file=vitest.workspace.ts
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: