You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exportasyncfunctionrender(url,manifest){const{ app, router }=createApp()// set the router to the desired URL before renderingawaitrouter.push(url)awaitrouter.isReady()// passing SSR context object which will be available via useSSRContext()// @vitejs/plugin-vue injects code into a component's setup() that registers// itself on ctx.modules. After the render, ctx.modules would contain all the// components that have been instantiated during this render call.constctx={}consthtml=awaitrenderToString(app,ctx)// the SSR manifest generated by Vite contains module -> chunk/asset mapping// which we can then use to determine what files need to be preloaded for this// request.constpreloadLinks=renderPreloadLinks(ctx.modules,manifest)return[html,preloadLinks]}
The text was updated successfully, but these errors were encountered:
This is pretty high importance if I'm understanding correctly. Currently we're seeing a FOUC because Vite isn't including the chunks from these modules in the SSR render. As a result, our styles aren't loading until the JS app has fully hydrated. We obviously can't bring that to production. @yyx990803 Could you comment on the feasibility of adding that ctx.modules populating functionality to this plugin?
Module information can be collected like Vue3
The text was updated successfully, but these errors were encountered: