workbox

Service worker - update cache on new version using skipWaiting()

一个人想着一个人 提交于 2020-04-18 06:12:32
问题 I have implemented Workbox to generate my service worker using webpack. This works - I can confirm revision is updated in the generated service worker when running "generate-sw": "workbox inject:manifest" . The problem is - I have noticed my clients are not updating the cache after a new release. Even days after updating the service worker my clients are still caching the old code and new code will only load after several refreshes and/or unregistering the service worker. For each release I

How to cache entire website first login using cache API (Service Worker)

牧云@^-^@ 提交于 2020-04-18 05:46:47
问题 I have a website with a few pages. I know all URL of the website and asserts and its a PHP based. My main objective is in the first login, I want to cache the entire website. Currently, I used SW to caching by navigation, that works fine. What is the better approach? Following is the code I tried. self.addEventListener('install', function (event) { event.waitUntil( caches.open(CACHE_DYNAMIC_NAME) .then(function (cache) { cache.addAll([ '/assets/app/css/vendor.css', '/assets/app/css/app.css',

Checking for service worker updates in a single page app

天大地大妈咪最大 提交于 2020-02-23 18:37:29
问题 We have a signal page application that has Service worker installed and active. Now our server rebuilds the app, Service worker file is being updated on the server side. Our client has no idea about this new Service worker file and it is still using old Service worker file. When It works? if I refresh/reload the app, new service worker is being installed . How can we refresh the client if service worker file is being updated on the server and client is not being reloaded? Possible solution :

Checking for service worker updates in a single page app

不羁岁月 提交于 2020-02-23 18:37:22
问题 We have a signal page application that has Service worker installed and active. Now our server rebuilds the app, Service worker file is being updated on the server side. Our client has no idea about this new Service worker file and it is still using old Service worker file. When It works? if I refresh/reload the app, new service worker is being installed . How can we refresh the client if service worker file is being updated on the server and client is not being reloaded? Possible solution :

Checking for service worker updates in a single page app

巧了我就是萌 提交于 2020-02-23 18:37:02
问题 We have a signal page application that has Service worker installed and active. Now our server rebuilds the app, Service worker file is being updated on the server side. Our client has no idea about this new Service worker file and it is still using old Service worker file. When It works? if I refresh/reload the app, new service worker is being installed . How can we refresh the client if service worker file is being updated on the server and client is not being reloaded? Possible solution :

Recommended precache payload size?

佐手、 提交于 2020-01-31 03:59:10
问题 (Publicly asking/answering on behalf of someone.) I'm using Workbox to generate a service worker that precaches resources for my progressive web app. Am I wrong to be reluctant to precache ~20mb of minified JavaScript? It's huge, obviously. 20mb seems way too much. My plan was to just precache the essential stuff, and use runtime caching for the rest. In other words, what are some general heuristics for determining what should and shouldn't be included in the precache payload? 回答1: There's a

Workbox Cache First not caching properly

寵の児 提交于 2020-01-16 11:57:32
问题 I am trying to build a Cache First strategy with workbox on a React + NextJS app, but i am facing a problem... I have the following rule: workbox.routing.registerRoute( new RegExp('/.*\/uploads|.*\/arquivos.*/'), new workbox.strategies.CacheFirst({ cacheName: 'cache-first', }) ); Looking at workbox log a got the following messages: Router responding to and Using Cache First to respond But nothing gets cached as can be seen on: enter image description here If I change the strategy from

Workbox Cache First not caching properly

吃可爱长大的小学妹 提交于 2020-01-16 11:57:10
问题 I am trying to build a Cache First strategy with workbox on a React + NextJS app, but i am facing a problem... I have the following rule: workbox.routing.registerRoute( new RegExp('/.*\/uploads|.*\/arquivos.*/'), new workbox.strategies.CacheFirst({ cacheName: 'cache-first', }) ); Looking at workbox log a got the following messages: Router responding to and Using Cache First to respond But nothing gets cached as can be seen on: enter image description here If I change the strategy from

React/WordPress PWA does not respond with a 200 when offline

别说谁变了你拦得住时间么 提交于 2020-01-13 16:59:46
问题 I am currently trying to build a WordPress theme using React/Redux. Everything is working as expected except for responding with 200 when offline. The build folder of CRA (Create React App) is located at /wp-content/themes/pwa/build . When online, WordPress loads the index.php for all routes. This registers the .css and .js from the build folder. Here everything is working as expected. Im trying to understand how to configure CRA / WorkBox to register the service worker at / and serve all

Workbox will not load

不羁岁月 提交于 2020-01-05 04:11:12
问题 I'm trying to use Workbox to add PWA functionality to my website. I'm following the Get Started guide, but I'm not getting far. When I run the website in Chrome I get the following error: Refused to load the script 'https://storage.googleapis.com/workbox-cdn/releases/3.6.1/workbox-sw.js' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval'". Per the docs, I am importing workbox-sw.js in my service worker file that is in my wwwroot folder with