-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
feat(nuxt): namespace global variables for multi-app support #27263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(nuxt): namespace global variables for multi-app support #27263
Conversation
|
f30a78c
to
b2ff8da
Compare
@@ -50,6 +50,7 @@ export default defineNuxtPlugin({ | |||
} | |||
Object.assign(nuxtApp.payload, await nuxtApp.runWithContext(getNuxtClientPayload)) | |||
// For backwards compatibility - TODO: remove later |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still wondering if we have to set the payload here / why it was marked for compat only?
b2ff8da
to
2c3f046
Compare
f2a86d2
to
4dee10a
Compare
13ef3b0
to
c0902ff
Compare
Co-authored-by: Daniel Roe <daniel@roe.dev>
985400f
to
404bef4
Compare
I have an idea - just an idea - perhaps we don't need to differentiate between the single app and multiple apps scenarios, as a single app is just a special case of multiple apps. Given the major version 4.0, this breaking change might be acceptable (it has been removed for the user anyway) |
Agreed, I would be happy to merge that just into v4. |
🔗 Linked issue
2nd task of #21635. Also linked to #25336 although it doesn't completely remove
window.__NUXT__
.📚 Description
This PR updates
window.__NUXT__
global variable to handle multi-app payloads and config by storing the data under theirappId
.Before:
After:
It also replaces scripts global IDs
__NUXT_DATA__
and__NUXT_LOGS__
with data attributes:Before:
After:
This will eventually allows the use of multiple Nuxt applications on a same page.
📝 To do:
future
/experimental
flagwindow.__NUXT__
update innuxt/test-utils
. See feat: add multi-app support for global var__NUXT__
test-utils#858