From 67e5417708d1ade18f42c16f6f0085e3787d06bf Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Wed, 13 Jul 2022 11:42:46 +0200 Subject: [PATCH] feat(nuxt): remove wrong `$nuxt` in Nuxt 3 BREAKING CHANGE: in Nuxt 3, `$nuxt` is no longer available in stores. This is because it was removed in Nuxt 3 and it is no longer the _context_ as it used to be. Most of the features used there, like `$fetch` are now globally available and therefore remove the need of it. You can also use [`useNuxtApp()`](https://v3.nuxtjs.org/bridge/bridge-composition-api/) when necessary. --- packages/nuxt/src/runtime/plugin.vue3.ts | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/packages/nuxt/src/runtime/plugin.vue3.ts b/packages/nuxt/src/runtime/plugin.vue3.ts index 608df03c..11d8eb21 100644 --- a/packages/nuxt/src/runtime/plugin.vue3.ts +++ b/packages/nuxt/src/runtime/plugin.vue3.ts @@ -6,12 +6,6 @@ export default defineNuxtPlugin((nuxtApp) => { nuxtApp.vueApp.use(pinia) setActivePinia(pinia) - // @ts-expect-error: _p is internal - pinia._p.push(({ store }) => { - // make it non enumerable so it avoids any serialization and devtools - Object.defineProperty(store, '$nuxt', { value: nuxtApp }) - }) - if (process.server) { nuxtApp.payload.pinia = pinia.state.value } else if (nuxtApp.payload && nuxtApp.payload.pinia) { @@ -25,13 +19,3 @@ export default defineNuxtPlugin((nuxtApp) => { }, } }) - -declare module 'pinia' { - export interface PiniaCustomProperties { - /** - * Nuxt context. - */ - // FIXME: where is this type? - // $nuxt: import('@nuxt/types').Context - } -} -- 2.47.2