Nuxt 4 config
Does my config look ok for Nuxt 4, just upgraded from 3. I can't seem to get Pina working in the devtools.
2 Replies
Hi @pook1574. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Your Nuxt 4 config looks generally correct for a Nuxt 4 project, and you are using the recommended way to enable Pinia with the @pinia/nuxt module in your modules array. Your use of aliases, runtimeConfig, and other options also aligns with Nuxt 4 documentation Nuxt Configuration Nuxt Configuration API.
Regarding Pinia not showing in DevTools:
- Your config enables devtools, which is required:
- You have @pinia/nuxt in your modules, which is correct for Nuxt 4 Pinia Migration. - Your config uses srcDir: 'app', which is fine, but note that in Nuxt 4, the default location for Pinia stores is inside the app/stores directory, not just stores at the project root. Make sure your stores are in app/stores if you use srcDir: 'app' Pinia Store Path Update. Common reasons Pinia does not appear in DevTools: 1. Store Not Imported/Used:
Pinia stores only appear in DevTools if they are actually imported and used in a component or plugin. If you haven't called your store (e.g., useUserStore()) in any component, it won't show up in DevTools. This is a common source of confusion Stack Overflow - Pinia store does not initialise. 2. DevTools/Pinia Tab Issues:
There have been some issues with the Pinia tab in Nuxt DevTools, especially around Nuxt 3.14 and later. Sometimes the tab shows "no data" or is unstable. This is a known issue and may not be related to your config Github Issue - Pinia tab is broken in 3.14. What to check: - Make sure you are importing and using your Pinia store in at least one component, for example: - If your stores are in app/stores (with srcDir: 'app'), your import should be from '@/stores/yourStore'. - If you still don't see Pinia in DevTools, it may be a DevTools bug rather than a config issue. Summary:
Your config is correct for Nuxt 4 and Pinia. The most likely reason Pinia is not showing in DevTools is that your store is not being used in any component, or you are encountering a known DevTools issue. Try importing and using your store in a component, and check again. If the problem persists, it may be a DevTools bug and not a misconfiguration on your part. Let me know if you need help with the store file structure or usage examples! ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
- You have @pinia/nuxt in your modules, which is correct for Nuxt 4 Pinia Migration. - Your config uses srcDir: 'app', which is fine, but note that in Nuxt 4, the default location for Pinia stores is inside the app/stores directory, not just stores at the project root. Make sure your stores are in app/stores if you use srcDir: 'app' Pinia Store Path Update. Common reasons Pinia does not appear in DevTools: 1. Store Not Imported/Used:
Pinia stores only appear in DevTools if they are actually imported and used in a component or plugin. If you haven't called your store (e.g., useUserStore()) in any component, it won't show up in DevTools. This is a common source of confusion Stack Overflow - Pinia store does not initialise. 2. DevTools/Pinia Tab Issues:
There have been some issues with the Pinia tab in Nuxt DevTools, especially around Nuxt 3.14 and later. Sometimes the tab shows "no data" or is unstable. This is a known issue and may not be related to your config Github Issue - Pinia tab is broken in 3.14. What to check: - Make sure you are importing and using your Pinia store in at least one component, for example: - If your stores are in app/stores (with srcDir: 'app'), your import should be from '@/stores/yourStore'. - If you still don't see Pinia in DevTools, it may be a DevTools bug rather than a config issue. Summary:
Your config is correct for Nuxt 4 and Pinia. The most likely reason Pinia is not showing in DevTools is that your store is not being used in any component, or you are encountering a known DevTools issue. Try importing and using your store in a component, and check again. If the problem persists, it may be a DevTools bug and not a misconfiguration on your part. Let me know if you need help with the store file structure or usage examples! ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
<@636587234191212554> Kapa.ai is still learning and improving, please let me know how I did by reacting below.