I can export and use everything when I use the following syntax: export const usePiniaStore = defineStore(‘testStore’, () => {
// several functions and an array of objects
When I try to export the function after closing the return statement and the usePiniaStore function via export default usePiniaStore I get following error message: SyntaxError: The requested module ‘http://localhost:5173/testproject/src/stores/piniaStore.js?t=’ doesn’t provide an export named: ‘usePiniaStore’.
My vue router throws a warning as well: Unexpected error when starting the router. The message is the same: The requested module doesn’t provide an export named: ‘usePiniaStore’
When I put the export back on top everything seems to work normally so I’m asking myself where the error is. I read it could be something related to the cache. When I use the export at the top I can see everything with the pinia section in vue devtools but when I put it at the bottom it dissapears in vue devtools. I left the default out, tried to export it as { usePiniaStore } and restartet the terminal but nothing worked.
I’d really appreciate your imput.
TrialAndError01 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.