You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently using service worker (using sw-precache) to cache my React app vendor.js(2.14MB) and app.js(212kb) scripts along with some other assets. however, on page reload all my assets are fetched again and the response 200 comes from service worker (cache), but all scripts are complied and reevaluated. So the app shell disappears for a little over a second and reappears. IS is possible to stop browser from fetching the vendor script or the app script if it hasn't changed and evaluating it again ? my service worker script does run first before vendor.js and app.js so I can check if my cached resources have changed? That way the on reload the appshell renders near instantly.
The text was updated successfully, but these errors were encountered:
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 is 100k, and achieves its first UI render in less than 5k.
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?
I'm currently using service worker (using sw-precache) to cache my React app vendor.js(2.14MB) and app.js(212kb) scripts along with some other assets. however, on page reload all my assets are fetched again and the response 200 comes from service worker (cache), but all scripts are complied and reevaluated. So the app shell disappears for a little over a second and reappears. IS is possible to stop browser from fetching the vendor script or the app script if it hasn't changed and evaluating it again ? my service worker script does run first before vendor.js and app.js so I can check if my cached resources have changed? That way the on reload the appshell renders near instantly.
The text was updated successfully, but these errors were encountered: