Replies: 1 comment 2 replies
-
This is not a Vitest error, this is a Vite error. Try importing your library using a simple Vite project. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I maintain a small module for a much larger project, i can't run tests with it with vite due to this kind of error:
Following the link, it just says to tell the maintainer. Well, since I am the maintainer I have no idea what to do next. I checked if my
package.json
or code has any significant differences to other libraries that can be importet just fine likejsdom
or@testing-library/jest-dom/matchers
but I don't see any significant difference. I've also tried all kinds of changes topackage.json
but the error persists. Even when I delete all the contents of the file in question, the error still persits, so I started assuming I am looking into the wrong direction.Reverse engineering where the problem is caused leads nowhere as string searching the error brings no results.
What exact config problem is vitest upset with, here ? What does it expect vs what I am giving it that makes it think my library need polyfill? I am not using anything from the global space other than
globalThis.window
in order to link something back for custom hooks and other functionality, but that should be fine if i use react testing tools that allow that kind of behavior.My best guess is that my tsconfig does something illegal that is unexpected by vitest, but without information on what it does incorrectly that is impossible to tell...
https://gitlab.zweieuro.at/wui/core/web-user-interface-node/-/tree/development is the library i wrote and am trying to make work.
Sidenote: I am using deno, but that only changes the imports to have a prefix.
TLDR:
What causes this error?
https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility
Beta Was this translation helpful? Give feedback.
All reactions