From: Eduardo San Martin Morote Date: Thu, 14 Oct 2021 10:16:06 +0000 (+0200) Subject: chore: add notes [skip ci] X-Git-Tag: @pinia/nuxt@0.0.5~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=257a8a6d36c365672c2daae87d0eeaea75168e0c;p=thirdparty%2Fvuejs%2Fpinia.git chore: add notes [skip ci] --- diff --git a/packages/nuxt/src/index.ts b/packages/nuxt/src/index.ts index 10f5836b..eecf8054 100644 --- a/packages/nuxt/src/index.ts +++ b/packages/nuxt/src/index.ts @@ -34,10 +34,6 @@ const module = defineNuxtModule({ 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 && diff --git a/packages/nuxt/templates/plugin.js b/packages/nuxt/templates/plugin.js index 156bfadd..427eb387 100644 --- a/packages/nuxt/templates/plugin.js +++ b/packages/nuxt/templates/plugin.js @@ -29,6 +29,7 @@ const PiniaNuxtPlugin = (context, inject) => { 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 })