Open vandelpavel opened 3 years ago
You're right, you can't combine both modes because i developped this extension with only SSG in mind.
But, the extension should build your app in SSR mode and generate static pages for the routes you provide in SSG options. It could be interesting to add this feature based on router option object.
Right now, i think it will be very difficult to handle both modes by yourself. I mean that the app extension will prevent you to do that easily. So, i have to implement this feature. I can't give you a date of release. I will come back to you to let you know how the things progress.
First, i will try to make available ssg
in process.env.MODE
quickly.
@vandelpavel
From release 1.1.0 you can use process.env.STATIC
to conditionnaly do things depending if you're app was built with quasar ssg generate
or not.
Hi @freddy38510, how does the process.env.STATIC
help with that?
I mean, if you exclude some routes (to work with SSG), is it going to use the SSR on the rest of the routes?
Thank you :)
It is going to fallback to SPA on the rest of the routes.
SSG + SSR on excluded routes is not implemented yet.
process.env.STATIC
can help if you build your app multiple times with different modes.
Out of curiosity, could you explain why you need to build your app with both modes (ssg + ssr) ? Isn't SSG + SPA on excluded routes sufficient for your use-case ?
Ahh okay, get it!
I would like to use both modes because some pages need fresh data + SEO + cookies + we don't want the spinner UX.
For the rest of the static page, SSG works great.
Ah, that makes sense, thanks for the explanation.
For now, implementing this feature is not a priority. First, I planned to support Vite.js and lazy hydration via a new package I'm working on.
But I will keep your need in mind and let you know when I start making progress.
Thank you Freddy. Wow, that would help with improving the time to Interactive, right?
Cheers
Yep that's right, in theory it should.
You can also lighten your client bundle with code splitting and only load the splitted chunks when hydration occurs.
In practice, splitted chunks are async components inside the LazyHydrationWrapper
or component wrapped with import-wrappers
like this:
hydrateNever(() => import('CompA.vue'));
By using the library this way with the ssg extension, the js code for the CompA
will never be loaded at client side.
That's a good one. I would love to help with these things, but I never dare to get into OSS...
@freddy38510 I'm trying to split my project and i need it to run half in SSG and the other in SSR. With that in mind my problem comes when i try to split routes and when i'm asking for the MODE i can't search for ssg. Also the portion of code that should run in ssr both runs in ssr and ssg.
Any clues on how to separate things?
(also i'm starting to get familiar with routing and dynamic routes) #22