addPlugin({ src: resolve(__dirname, '../templates/plugin.js') })
- // Define pinia resolution to ensure plugins register global context successfully
- // TODO: needed with @nuxt/bridge but not without it...
- // nuxt.options.alias['pinia'] = nuxt.options.alias['pinia'] || resolveModule('pinia/index.mjs')
-
// transpile pinia if @vue/composition-api is transpiled because we must use the same instance
if (
!nuxt.options.dev &&
setActivePinia(pinia)
// add access to `$nuxt`
+ // TODO: adapt to Nuxt 3 with a definePlugin
pinia._p.push(({ store }) => {
// make it non enumerable so it avoids any serialization and devtools
Object.defineProperty(store, '$nuxt', { value: context })