You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get this error whenever I import a Pinia store into my test:
SyntaxError: The requested module 'vue-demi' does not provide an export named 'computed'
❯ ../../async /Users/dmix/dev/callpixels/app/javascript/__tests__/stores/target_options_test.ts:1:256
Also got a more detailed version with some tweaks:
SyntaxError: Named export'computed' not found. The requested module 'vue-demi' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'vue-demi';
const { getCurrentInstance, inject, toRaw, watch, unref, markRaw, effectScope, ref, isVue2, isRef, isReactive, set, onUnmounted, reactive, toRef, del, nextTick, computed, toRefs } = pkg;
❯ ../../async /Users/dmix/dev/callpixels/app/javascript/__tests__/stores/target_options_test.ts:1:256
This is the code in the test file (removing pinia stuff resolves the error)
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 properly
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
The text was updated successfully, but these errors were encountered: