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.

104 questions
0
votes
1 answer

Caching Url without explicit declaration in dynamicUrlToDependencies using sw-precache

Is there a way, using sw-precache, to cache the url you are currently on without exactly specifying the url string in dynamicUrlToDependencies? My page caches when I supply a specific relative url /dynamic/url-circle, but not if I supply just /. I'm…
0
votes
1 answer

how do I include files that sw-precache misses

Context I'm using parcel-plugin-sw-precache which wraps around sw-precache to make it work with Parcel.js. Everything was working as expected, and I have been testing my offline app. Problem I added react-pdf.js into my project, one of the…
0
votes
1 answer

How to precache user-specific content with Workbox?

I have a membership site and I want to create cache files for only logged-in users. How is it possible to do with Workbox ? Solution: I found that workbox has a very good feature in this case. It is possible to use cacheable response. So from the…
0
votes
1 answer

How to configure sw-precache-webpack-plugin to cache custom paths

I have created a react app with create-react-app and ejected it. service-worker.js is looking for /index.html, /static/js/main.js and /static/css/main.css to cache. I want to configure it to look for /index.html, /js/main.js and /js/main.css without…
0
votes
1 answer

How do I make periodic hits in sw-precache

I have been trying to fetch and update the service worker without having the user interaction. I was able to cache the pagaes, but only upon refresh I was able to fetch the updates build, which requires user interaction. Any help on how could it be…
Jay
  • 473
  • 1
  • 6
  • 19
0
votes
1 answer

Total precache size is about 0 B for 0 resources

With grunt-sw-precache, I am trying to cache my application: 'develop': { // staticFileGlobs: [ // 'app/styles/**/*.css', // 'font/**/*.{woff,ttf,svg,eot}', // 'app/images/**/*.{gif,png,jpg}', // …
systemdebt
  • 4,589
  • 10
  • 55
  • 116
0
votes
1 answer

sw-precache-webpack-plugin remove old cache

I am using create-react-app that includes sw-precache-webpack-plugin i also config cacheId in webpack.config.prod, i noticed webpack generate news files and filenames after every build and all are stored in the same cache but the old files also…
0
votes
2 answers

How made sw-precache with network first?

I have PWA web site with sw-precache with this sequence: Reload the page The service worker should update the cache in the background When its done, you should see New or updated content is available. in the console The actual visible changes…
0
votes
2 answers

Make Changes To sw-precache service-worker

I am using sw-precache and I understand that in order to edit the service-worker.js file I need to do this (as detailed in the service-worker.js file) // This file should be overwritten as part of your build process. // If you need to extend the…
SSED
  • 475
  • 3
  • 9
  • 22
0
votes
2 answers

Angular 2+ using sw-precache with github project pages

I have a simple Angular application and I'm trying to make it offline-capable with the help of a Service Worker. I have followed this tutorial on how to set up service workers:…
0
votes
0 answers

Service Worker Installed and Activated, But No Fetch Event

I have a service worker generated by sw-precache that I'm registering on a page. The install and activate events both fire and complete successfully, files are cached, and the registration on the page completes successfully, however the fetch event…
Ixonal
  • 616
  • 8
  • 18
0
votes
1 answer

How to cache googleapis.com using sw-precache runtimeCaching

I make use of material icons and roboto font on my site and I've been trying to cache it using sw-precache runtimeCaching API but it doesn't work, I'm not sure if I'm doing it right. I need my service worker to fetch these files from cache. Here's…
HackAfro
  • 720
  • 1
  • 12
  • 28
0
votes
0 answers

sw-precache StripPrefixMulti option

I'm trying to remove two prefixes from my service-worker file but the stripPrefixMulti option doesn't seem to do the trick. I have : ./dist ./src/assets I want to strip : ./ src/ and replace them with / So in my sw.config I have : stripPrefix…
wmik
  • 734
  • 10
  • 23
0
votes
2 answers

Angular Template Cache with Service Worker Issue

I have a gulp setup that puts all my html in template cache for faster access in angular. I'm trying to add a service worker to my project, using sw-precache, so that it can be used offline. If I'm connected to the network, everything works fine. …
JakeHova
  • 1,189
  • 2
  • 15
  • 36
0
votes
1 answer

Grunt sw-precache runs but does nothing

I am using sw-precache for caching static resources in my angular app. Grunt is the task runner i am using, I have integrated sw-precache in my gruntfile.js but it does nothing on run It should have generated service-worker.js file I think i am…
Mohit Bajoria
  • 476
  • 1
  • 4
  • 15