@pinia/nuxt
@pinia/nuxt
Nuxt module for Pinia
Automatic Installation
Use nuxi to automatically add this module to your Nuxt project:
npx nuxi@latest module add pinia
Manual Installation
Add dependencies to your Nuxt project:
npm i pinia @pinia/nuxt
Enable the @pinia/nuxt module in nuxt.config.ts:
export default defineNuxtConfig({
modules: ['@pinia/nuxt'],
})
Configuring the Module
By default, this module adds stores folder to auto imports, in which you can organize code related to Pinia stores in one place.
[!TIP] In the new directory structure introduced since Nuxt 4, this directory is
app/stores.
You can customize this behaviour using the pinia property in nuxt.config.ts:
export default defineNuxtConfig({
modules: ['@pinia/nuxt'],
// configure the module using `pinia` property
pinia: {
/**
* Automatically add stores dirs to the auto imports. This is the same as
* directly adding the dirs to the `imports.dirs` option. If you want to
* also import nested stores, you can use the glob pattern `./stores/**`
* (on Nuxt 3) or `app/stores/**` (on Nuxt 4+)
*
* @default ['stores']
*/
storesDirs: [],
},
})
License
Related Packages
nuxt-spa-store-init
A simple Nuxt module that will hydrate the VueX store when running in SPA mode (...
4,282
14
Version History
| Version | Released | License |
|---|---|---|
| 1.0.3 | MIT | |
| 1.0.2 | MIT | |
| 1.0.1 | MIT | |
| 1.0.0 | MIT | |
| 0.11.3 | MIT | |
| 0.11.2 | MIT | |
| 0.11.1 | MIT | |
| 0.11.0 | MIT | |
| 0.10.1 | MIT | |
| 0.10.0 | MIT | |
| 0.9.0 | MIT | |
| 0.8.0 | MIT | |
| 0.7.0 | MIT | |
| 0.6.1 | MIT | |
| 0.6.0 | MIT | |
| 0.5.5 | MIT | |
| 0.5.4 | MIT | |
| 0.5.3 | MIT | |
| 0.5.2 | MIT | |
| 0.5.1 | MIT | |
| 0.5.0 | MIT | |
| 0.4.11 | MIT | |
| 0.4.10 | MIT | |
| 0.4.9 | MIT | |
| 0.4.8 | MIT | |
| 0.4.7 | MIT | |
| 0.4.6 | MIT | |
| 0.4.5 | MIT | |
| 0.4.4 | MIT | |
| 0.4.3 | MIT |
Showing the latest 30 of 56. See every release on npm
Pre-releases (1)
| Version | Released | License |
|---|---|---|
| 0.5.2-beta.0 | MIT |