Skip to content

Commit df75778

Browse files
committed
fix(nuxt): make $nuxt non enumerable
Fix #574
1 parent 4716b5e commit df75778

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

nuxt/plugin.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ const myPlugin = (context, inject) => {
2020
setActivePinia(pinia)
2121

2222
// we bypass warnings
23-
// @ts-expect-error
24-
pinia._p.push(() => ({ $nuxt: context }))
23+
pinia._p.push(({ store }) => {
24+
// non enumerable to avoid it being serialized or displayed in devtools
25+
Object.defineProperty(store, '$nuxt', { value: context })
26+
})
2527

2628
if (process.server) {
2729
context.beforeNuxtRender(({ nuxtState }) => {

0 commit comments

Comments
 (0)