feat(nitro,nuxt,schema): add experimental SSR streaming with unhead v3#34411
feat(nitro,nuxt,schema): add experimental SSR streaming with unhead v3#34411
Conversation
β¦3 and bot-aware fallback
|
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
f020808 to
0e458df
Compare
@nuxt/kit
@nuxt/nitro-server
nuxt
@nuxt/rspack-builder
@nuxt/schema
@nuxt/vite-builder
@nuxt/webpack-builder
commit: |
Merging this PR will not alter performance
Comparing Footnotes
|
|
Added the IIFE client so tags can run as they're streamed in |
| && !ssrError | ||
| && !isRenderingPayload | ||
| && !import.meta.prerender | ||
| && !componentIslands |
There was a problem hiding this comment.
was running into some issues here (this was if componentIslands was enabled not in the renderring context)
There was a problem hiding this comment.
yes, I would like this not to be a requirement - currently there's a string.replace call that we need to work around (cc: @huang-julien)
There was a problem hiding this comment.
I'll take a look this weekend or the next one
| iifeScript = `<script async src="${buildAssetsURL(iifeChunkFileName)}"></script>` | ||
| } else { | ||
| // Dev: inline the IIFE code (Vite dev server transforms to ESM so script src won't work) | ||
| const { streamingIifeCode } = await import('unhead/stream/iife') |
There was a problem hiding this comment.
needs to be @unhead/vue/stream/iife
There was a problem hiding this comment.
also ideally I'd like to import at the top level rather than dynamically
| const headChunk = renderSSRHeadSuspenseChunk(ssrContext.head) | ||
| if (headChunk) { | ||
| controller.enqueue(encoder.encode(`<script>${headChunk}</script>`)) | ||
| controller.enqueue(encoder.encode(`<script>${headChunk};document.currentScript.remove()</script>`)) |
π Linked issue
resolves #4753
π Description
one of the longest-standing nuxt issues...
this PR:
experimental.ssrStreamingto send an HTML shell (head, styles, preload hints) immediately + then stream the Vue app body viarenderToWebStream@unhead/vueto v3 beta for streaming head supportrouteRules