-
-
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
Unable to import commonjs file with absolute path #2218
Comments
Cannot open reproduction:
|
Oopps, yes, I renamed the test afterwards. Here is the link to the repo: https://github.com/danez-labs/vitest-absolute-import/ |
This issue is cause by the same problem as #1864 ( |
Fixed with #1868, released in 0.24.4 |
Thanks for the quick fix. I can confirm this works now. |
Describe the bug
When I try to import a commonjs file with an absolute path (e.g.
/tmp/something.js
) vitest fails to resolve the relative dependencies of this just-imported file.So for example if I have
and in my test I try to do
I get
Which is also not a real path.
When I try the same thing with ESM and mjs files it works.
Reproduction
https://github.com/danez-labs/vitest-absolute-import/
Clone and run
npm test
.There are two tests, one that fails, although it should work, the other uses
/@fs/
as a workaround and works, but it is not a real solution.System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: