From: Eduardo San Martin Morote Date: Mon, 16 Aug 2021 12:54:00 +0000 (+0200) Subject: fix(nuxt): make `$nuxt` non enumerable X-Git-Tag: v0.5.4~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=df75778917ed1543a8be73d5bbfa32750f811ab2;p=thirdparty%2Fvuejs%2Fpinia.git fix(nuxt): make `$nuxt` non enumerable Fix #574 --- diff --git a/nuxt/plugin.js b/nuxt/plugin.js index 4f96e787..2ab7645c 100644 --- a/nuxt/plugin.js +++ b/nuxt/plugin.js @@ -20,8 +20,10 @@ const myPlugin = (context, inject) => { setActivePinia(pinia) // we bypass warnings - // @ts-expect-error - pinia._p.push(() => ({ $nuxt: context })) + pinia._p.push(({ store }) => { + // non enumerable to avoid it being serialized or displayed in devtools + Object.defineProperty(store, '$nuxt', { value: context }) + }) if (process.server) { context.beforeNuxtRender(({ nuxtState }) => {