Sapper: Service worker 'side rendering'

Created on 18 Dec 2017  路  7Comments  路  Source: sveltejs/sapper

I hadn't encountered this phrase before, but @dfabulich has an interesting suggestion 鈥斅爐he service worker could perform 'SSR' if it had the necessary code to hand.

Not quite sure how practical that is (we'd basically need to load and run the entire server webpack bundle in the service worker, which probably means generating a separate productionised version that doesn't assume any Nodeisms), but it could be a performance win? Am not quite sure, need to think through all the ramifications.

enhancement help wanted internals rendering service worker

Most helpful comment

I know this feature request has gotten a little old by now, but to me this would be very important since I'm deploying over Cloudflare Workers currently and such an approach would allow me to work originless. That would be awesome - yes please!

All 7 comments

Google documents a sample of it here: https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#serviceworker-side-templating They call it "ServiceWorker-side templating" but it's the same idea.

If I were implementing this, I'd run the SW code on the server side.

Cloudflare workers use a set of APIs that are similar to what service workers use, so if there were a separate sapper sw-build command its output could probably be adapted to enable Cloudflare Worker "originless" deployments.

Yes, I was hoping for Cloudflare Worker compatibility also.

I know this feature request has gotten a little old by now, but to me this would be very important since I'm deploying over Cloudflare Workers currently and such an approach would allow me to work originless. That would be awesome - yes please!

I just saw cloud flare announced https://blog.cloudflare.com/rendering-react-on-the-edge-with-flareact-and-cloudflare-workers/amp/. Maybe there is se inspiration we can take from this project?

Closing as the proposal is no longer relevant for kit

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Rich-Harris picture Rich-Harris  路  4Comments

UnwrittenFun picture UnwrittenFun  路  4Comments

nikku picture nikku  路  4Comments

Rich-Harris picture Rich-Harris  路  3Comments

nolanlawson picture nolanlawson  路  4Comments