-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Error with: __vite_ssr_import_meta__.hot.acceptExports
when running vitest
tests through @testing-library/svelte
#909
Comments
__vite_ssr_import_meta__.hot.acceptExports
when running tests through @testing-library/svelte
__vite_ssr_import_meta__.hot.acceptExports
when running tests through @testing-library/svelte
__vite_ssr_import_meta__.hot.acceptExports
when running tests through @testing-library/svelte
__vite_ssr_import_meta__.hot.acceptExports
when running vitest
tests through @testing-library/svelte
came up in this discord thread https://discord.com/channels/457912077277855764/1240267908744220743 might have to do with vitest and ssr mode by default, see vitest-dev/vitest#2834 leaving this as info here for now, we might need a different way to tackle this dilemma in svelte5 |
one way could be for vite-plugin-svelte to check one problem that still would remain is resolve conditions. we need to resolve svelte itself with the browser condition too so adding that in the config hook would be one way. But this could break tests that actually test something in .server.ts files that relies on some node only package that doesn't work with that ... ugh. Last idea for now is either checking the importer if it is a vitest spec/test and only then explicitly compile for client, or have a query param that allows users to do |
I actually don't hate this idea but does this mean that when testing components they are actually ran SSR? |
For what it's worth, in
Messing with |
ooh, thats neat. Maybe we should just document that better then, although it would be neat if the vite plugin disabled hmr so the user won't have to. For svelte5, the Given the presence of vitest in create-svelte as an option, i'd say the argument for vite-plugin-svelte checking process.env.VITEST and then ensuring that things are smooth isn't outlandish. But ideally an explicitly set option is still respected. |
Describe the bug
I honestly don't have much knowledge about vite's internals or even public API. I just know that when using
@sveltejs/vite-plugin-svelte@4.0.0-next.1
my tests started breaking.Reproduction URL
https://github.com/Hugos68/vite-plugin-svelte-accepts-exports-repro
Reproduction
See README of the reproduction repository
Logs
System Info
The text was updated successfully, but these errors were encountered: