Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Flexible choice of rendering (SSR, SSG, incremental SSG) #1324

Closed
websocket98765 opened this issue Jul 16, 2020 · 8 comments
Closed

Flexible choice of rendering (SSR, SSG, incremental SSG) #1324

websocket98765 opened this issue Jul 16, 2020 · 8 comments
Labels

Comments

@websocket98765
Copy link

Currently, Svelte/Sapper appear to only offer all SSR (via build) or all static (via export).

In contrast, Next.js routes can be SSR, SSG, or incremental SSG, and are not required to all be the same.

  • SSR: built when requested by a user.
  • SSG: built during build step.
  • Incremental SSG: first request by user fetches data & builds static version, subsequent requests receive static version.

This allows a site's marketing pages to use SSG, a dashboard to use SSR, and a blog to use incremental SSG.

Describe the solution you'd like

It'd be useful if Sapper allowed a way to choose which method is used per route.

How important is this feature to you?

It's not urgent. But I think it will be important long term for a framework to offer this to be competitive.

Adding this issue to track/follow this.

More info

@antony
Copy link
Member

antony commented Jul 16, 2020

This is something that we're definitely interested in, but not something we have a plan for yet. We're open to ideas, thoughts, RFCs etc.

@antony antony added breaking Breaking Changes proposal labels Jul 16, 2020
@firrae
Copy link

firrae commented Jul 18, 2020

Currently Svelte seems like where I want to be, but I feel stuck between choosing the optimal path for my web app in incremental static gen, and using a tool I think is the better overall framework.

I will say I will be watching this as I might begin with NextJS but I'd be willing to jump to Sapper if this was brought in. I'm not big, but I feel it's becoming more popular across the board and I can bet NuxtJS picks up the feature soon as well.

@antony
Copy link
Member

antony commented Aug 11, 2020

This is related to #1346 and related to the RFC I'm working on. I think adamb on discord is also doing something along these lines.

I'll try to publish the RFC as soon as possible to try to bring all efforts into a single place.

@ajbouh
Copy link

ajbouh commented Aug 11, 2020

Is distinguishing between the need for SSG and SSR really as simple checking whether a page lacks/has a preload function?

@pixelbucket-dev
Copy link

pixelbucket-dev commented Nov 21, 2020

To be clear, I am absolutely new to Svelte/Sapper. I was just intrigued by the concept of starting off with it and do a blog with SSG and I wrongly assumed Sapper supports this already (after all the rave in the media :-P). However, after realising this is not supported (yet) I searched around a bit and found ElderJS https://github.com/elderjs/elderjs. This seems to do exactly what is requested here. Maybe there can be some synergies.

@Catsvilles
Copy link

I really hope Incremental Static Regeneration will come to the new SvelteKit project! :)

@benmccann
Copy link
Member

SvelteKit has prerendering: https://github.com/sveltejs/kit/blob/master/documentation/docs/10-prerendering.md

It also has maxage: https://github.com/sveltejs/kit/blob/master/documentation/docs/03-loading.md#maxage

Hopefully that solves most of this issue. I'm going to go ahead and close this since all development effort is focused on SvelteKit

@olimination
Copy link

Similar issues handled here:

sveltejs/kit#661

sveltejs/kit#2369

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants