Re: [w3c/ServiceWorker] is it possible to stop browser to refetch scripts and reevaluate them if they haven't changed? (#978)

I'm going to close this because it doesn't seem like a service worker spec issue, but I'll continue to provide support (and reopen it if it does turn out to be a spec issue).

> I'm currently using service worker (using sw-precache) to cache my React app vendor.js(2.14MB) and app.js(212kb)

That's a *huge* amount of JavaScript, likely to bring a lower-end device to a crawl. Do you really need all that? For instance, the entire [SVGOMG app](https://jakearchibald.github.io/svgomg/) is 100k, and achieves its first UI render in less than 5k.

I don't know your app, so maybe it *does* need that amount of code, but does it need all that code up front? I had a little rant about this on Twitter https://twitter.com/jaffathecake/status/776015862914514944.

> So the app shell disappears for a little over a second and reappears

The key is to render before & without your JavaScript.

> IS is possible to stop browser from fetching the vendor script or the app script if it hasn't changed and evaluating it again ?

But if that script is rendering the page, won't you be left with a blank page? You could cache the output of the script, but if this is acceptable, why not do that on the server or as part of a build process?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/978#issuecomment-246991503

Received on Wednesday, 14 September 2016 12:04:33 UTC