NuxtN
Nuxt12mo ago
7 replies
dmarr

Trouble with pinia - `defineStore is not defined` when a layer containing a pinia store is called

I have been fighting this issue for awhile now, but when I have a layer in my app that is packaged separately (non-monorepo) and it uses pinia, I get errors in my app: defineStore is not defined -- I have tried so many things to work around this, and even have a PR that I think fixes the issue on pinia: https://github.com/vuejs/pinia/pull/2699

Maybe this is a shot in the dark, but if anyone can help me understand where/why that is failing it would be a big help. If I look in the imports.d.ts file in my app's .nuxt dir, I can see that defineStore is exported:

export { defineStore, acceptHMRUpdate, usePinia, storeToRefs } from '../node_modules/@pinia/nuxt/dist/runtime/composables';


I am not sure how to troubleshoot this further.
GitHub
When using the pinia nuxt module with nuxt layers, there were some things that don't appear to work correctly.
I am trying to solve for a nuxt layer workflow, which adds the pinia module an...
Was this page helpful?