Sapper: Flexible choice of rendering (SSR, SSG, incremental SSG)

Created on 16 Jul 2020  路  5Comments  路  Source: sveltejs/sapper

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

breaking proposal rendering

Most helpful comment

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.

All 5 comments

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.

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.

This is related to https://github.com/sveltejs/sapper/issues/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.

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

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

antony picture antony  路  3Comments

milosdjakovic picture milosdjakovic  路  3Comments

mylastore picture mylastore  路  3Comments

benmccann picture benmccann  路  3Comments

keyvan-m-sadeghi picture keyvan-m-sadeghi  路  4Comments