From df75778917ed1543a8be73d5bbfa32750f811ab2 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Mon, 16 Aug 2021 14:54:00 +0200 Subject: [PATCH] fix(nuxt): make `$nuxt` non enumerable Fix #574 --- nuxt/plugin.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 }) => { -- 2.47.3