Skip to content

Latest commit

 

History

History
36 lines (23 loc) · 1.16 KB

migration-v2-v3.md

File metadata and controls

36 lines (23 loc) · 1.16 KB

Migrating from v2 to v3

Pinia v3 is a boring major release with no new features. It drops deprecated APIs and updates major dependencies. It only supports Vue 3. If you are using Vue 2, you can keep using v2. If you need help, book help with Pinia's author.

For most users, the migration should require no change. This guide is here to help you in case you encounter any issues.

Deprecations

defineStore({ id })

The defineStore() signature that accepts an object with an id property is deprecated. You should use the id parameter instead:

defineStore({ // [!code --]
  id: 'storeName', // [!code --]
defineStore('storeName', { // [!code ++]
  // ...
})

PiniaStorePlugin

This deprecated type alias has been removed in favor of PiniaPlugin.

New versions

  • Only Vue 3 is supported.
  • TypeScript 5 or newer is required.
  • The devtools API has been upgraded to v7.

Note

To use Pinia with Devtools v6, use Pinia 2

Nuxt

The Nuxt module has been updated to support Nuxt 3. If you are using Nuxt 2 or Nuxt bridge, you can keep using the old version of Pinia.