Skip to content
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

Can't build with both modes: SSG and SSR. #33

Open
vandelpavel opened this issue Dec 17, 2020 · 9 comments
Open

Can't build with both modes: SSG and SSR. #33

vandelpavel opened this issue Dec 17, 2020 · 9 comments
Labels
enhancement New feature or request

Comments

@vandelpavel
Copy link

@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

@vandelpavel vandelpavel changed the title cant get process.env.MODE can't get process.env.MODE Dec 17, 2020
@vandelpavel vandelpavel changed the title can't get process.env.MODE Can't get process.env.MODE Dec 17, 2020
@freddy38510
Copy link
Owner

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.

@freddy38510 freddy38510 changed the title Can't get process.env.MODE Can't build with both modes: SSG and SSR. Dec 17, 2020
@freddy38510 freddy38510 added the enhancement New feature or request label Dec 17, 2020
@freddy38510
Copy link
Owner

@vandelpavel

From release 1.1.0 you can use process.env.STATICto conditionnaly do things depending if you're app was built with quasar ssg generate or not.

@franco-onevillas
Copy link

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 :)

@freddy38510
Copy link
Owner

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 ?

@franco-onevillas
Copy link

franco-onevillas commented Jul 15, 2022

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.

@freddy38510
Copy link
Owner

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.

@franco-onevillas
Copy link

Thank you Freddy. Wow, that would help with improving the time to Interactive, right?

Cheers

@freddy38510
Copy link
Owner

freddy38510 commented Jul 18, 2022

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.

@fprl
Copy link

fprl commented Jul 18, 2022

That's a good one. I would love to help with these things, but I never dare to get into OSS...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants