Questions tagged [sw-precache]

sw-precache is a JavaScript build tool used to generate a service worker file.

The sw-precache library is a JavaScript build tool. When properly configured, it will generate a service worker file that handles precaching a web app's local, static resources, serving those resources cache-first, and keeping the cached resources up to date.

sw-precache is frequently used in conjunction with sw-toolbox, to handle both precaching of local resources and runtime caching of dynamic resources.

sw-precache's Getting Started guide explains its usage in more detail.

103 questions
24
votes
6 answers

How to force service worker to update?

I'm using sw-precache to generate my service work with Polymer CLI build process, so it's intended to update the hash of updated files to signal a need to update the cache. But my updated content is not being replaced in cache, so it's getting an…
Jp_
  • 4,771
  • 4
  • 21
  • 32
18
votes
1 answer

service worker and sw precache with angular universal

I used sw precache with service worker.I cached only browser folder in service worker.So that server side rendering not working in service worker.can anyone pls help me to solve this.if ssr working service worker not working and vice versa below is…
kamalav
  • 1,040
  • 2
  • 11
  • 27
16
votes
2 answers

How: ServiceWorker check if ready to update

What I am trying to achieve: render page with loader/spinner if service-worker.js is registered and active, then check for updates if no updates, then remove loader if updatefound and new version installed, then reload the page else register…
Aivaras
  • 3,103
  • 23
  • 26
16
votes
3 answers

Long time waiting Request to Service Worker

I have noticed that the time waiting for service workers to respond with items from the cache is not as fast as you would expect it to be. I have seen the same wait times with both sw-precache and a custom written service worker. What are the…
15
votes
2 answers

Service Worker termination by a timeout timer was canceled because DevTools is attached

OS: Windows 10 Pro webpack: 1.14.0 sw-precache-webpack-plugin: 0.9.1 sw-precache: 5.0.0 So, I launch my site and don't actively do anything for a few moments, and then the above specified error message is generated in devTools. If some process is…
TheoG
  • 1,278
  • 2
  • 16
  • 42
9
votes
2 answers

Exclude subsite urls while using sw precache in angular5

Can I exclude some urls while using sw precache for generating service worker.Below is my swprecache.config.json module.exports = { navigateFallback: '/index.html', stripPrefix: 'dist', root: 'dist/', staticFileGlobs: [ 'dist/index.html', …
kamalav
  • 1,040
  • 2
  • 11
  • 27
9
votes
2 answers

How to modify auto generated service-worker in Create-React-App

I have created a sample app from Create-React-App library. When I ran the build command then it generates a service-worker on its own using cache-first strategy. But I need some more functionality like cache some API responses n all. I don't know…
Yash Kochar
  • 431
  • 5
  • 15
9
votes
1 answer

Can a service worker built with Google's sw-precache really be networkFirst?

I run the website https://www.igluonline.com running Hugo and I recently installed a service worker following Google's sw-precache. This is the Config file: module.exports = { staticFileGlobs: [ 'dist/css/**.css', 'dist/**/*.html', …
7
votes
3 answers

Progressive Web App (PWA) in standalone mode OAuth error

After I saved my PWA (Test App) built using Create React App to homescreen and launched the app in standalone mode on android using chrome and iOS using safari. Then in the app I initiate Firebase method signInWithPopup(GoogleProvider) the device…
7
votes
1 answer

"New version available" with service worker and sw-precache

I'm trying to use sw-precache, but I must be doing something wrong! I'm mostly using the demo code available from the github repo and can't seem to get updates to the app to come through. Once it's cached the first time, it never checks for new…
7
votes
2 answers

Service worker Failed to load resource: net::ERR_INTERNET_DISCONNECTED

Im currently implementing a PWA using Polymer + service workers. Generally, the service worker works fine. If I run my application it's all fine. I can see the service worker cache being filled in with images, html files, fonts and what not. This is…
Joey Roosing
  • 2,055
  • 5
  • 23
  • 40
6
votes
1 answer

What files should be Precached by a Service Worker (in general)?

I appreciate this question might be slighty 'opinion based', however, I think a generalised answer could very much help others in the future that are interested in learning more about PWA's and Service Workers. Background I have searched around the…
Ben Carey
  • 14,734
  • 16
  • 77
  • 155
6
votes
1 answer

Service workers on cordova app

Can i use service workers inside hybrids apps(ionic 1/cordova) running on android devices? I'm getting some errors when trying to install a service worker on ionic app running on android device, because android uses file protocol to serve files and…
5
votes
2 answers

Service Worker skipWaiting unable to activate currently waiting SW

Description: We are using sw precache for caching the scripts before hand, hence to update the scripts we are giving reload option, for that we are listening the worker message to skip waiting the newly install service worker for unknown reason we…
5
votes
1 answer

Angular 2 - Service worker not found - A bad HTTP response code (404)

I used sw-precache to generate a service worker for a Firebase hosted Angular 2 app. Error: Service Worker registration failed: TypeError: Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the…
Ciprian
  • 2,567
  • 5
  • 48
  • 85
1
2 3 4 5 6 7