nuxt / nuxt

The Intuitive Vue Framework.
https://nuxt.com
MIT License
52.94k stars 4.86k forks source link

Remove `window.__NUXT__` once app initialises #25336

Closed manniL closed 8 hours ago

manniL commented 5 months ago

Describe the feature

Apparently it only exists for backwards-compat according to code comments:

https://github.com/nuxt/nuxt/blob/648ef069931336b8ee0c0e48fef3ee700ebc3dbe/packages/nuxt/src/app/plugins/revive-payload.client.ts#L52-L53

Nuxt v4 might be a good point to remove it if that's the case.

PR: #19205

Additional information

Final checks

martinszeltins commented 5 months ago

I'm not familiar with internal Nuxt codebase but as a user of Nuxt, I kind of enjoy using window.__NUXT__ to access data when Vue devtools are not available. I often look at pinia store through window.__NUXT__.pinia. And even cooler is that it is also available on prod which makes debugging really pleasant.

manniL commented 5 months ago

@martinszeltins you can use window.useNuxtApp in Nuxt 3 for that 😋 Here is a link to the PR introducing it and to a video about it I made

martinszeltins commented 5 months ago

@martinszeltins you can use window.useNuxtApp in Nuxt 3 for that 😋 Here is a link to the PR introducing it and to a video about it I made

Ah, I wasn't aware of window.useNuxtApp, I guess in that case window.__NUXT__ is indeed not needed anymore.

sohaha commented 1 week ago

In the case of closed SSR, currently window. Write too much unnecessary code, SPA application is not very friendly, there is no way to remove

bbhxwl commented 6 days ago

Is there a way to use a micro front-end?