'vue-demi' causes errors when importing into Vitest test (only the .mjs file breaks it) #1525
Unanswered
dmix
asked this question in
Help and Questions
Replies: 1 comment
-
If anybody is experiencing this, it is caused by https://github.com/vueuse/vue-demi package and has been fixed in the release https://github.com/vueuse/vue-demi/releases/tag/v0.11.0 For me, all I had to do was to install |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
I get this error whenever I import a Pinia store into my test:
Also got a more detailed version with some tweaks:
This is the code in the test file (removing pinia stuff resolves the error)
This is not a new issue, others have managed to solve it by explicitly adding .mjs settings to webpack or nuxt config:
vueuse/vueuse#718 (comment)
The problem is that I'm using Vite and not webpack, so I dont know how to apply a similar config setting.
I resolved the issue by simply deleting the .mjs file
rm ./node_modules/pinia/dist/pinia.mjs
, this is fine because there's also the exact same .js version of this file that DOES import properlyIs there a way to fix this
mjs
issue?Reproduction
My full vite.config.ts file:
https://gist.github.com/dmix/780c81495d3fdfdf140e7cbe1e95e4c0
Expected behavior
The pinia.mjs file should be imported properly allowing the tests to run
Actual behavior
Error message whenever running
yarn run vitest run
Additional information
No response
Beta Was this translation helpful? Give feedback.
All reactions