I wish to use Workbox for caching local as well as remote image assets. Is this currently supported, if so how?
Essentially I'd like to have the following functionality:
workboxBuild.injectManifest({
swSrc: 'app/sw.js',
swDest: 'build/sw.js',
globDirectory: 'build',
globPatterns: [
'*.css',
'index.html',
'app.js',
'http://remote/image.jpg'
],
If I manually add the remote HTTP asset to the generated service worker file, that works (see below) but I wish to generate that service worker file without having to manually edit it.
importScripts('https://storage.googleapis.com/workbox-cdn/releases/3.4.1/workbox-sw.js');
if (workbox) {
console.log(`Yay! Workbox is loaded 🎉`);
workbox.precaching.precacheAndRoute([
{
"url": "app.css",
"revision": "f8d6a881fb9d586ef6fd676209e1613b"
},
{
"url": "index.html",
"revision": "ce6238d5b3c1e4e559349549c9bd30aa"
},
{
"url": "app.js",
"revision": "4357dbdbcc80dcfbe1f8198ac0313009"
},
{
"url": "http://remote/image.jpg"
}
]);
} else {
console.log(`Boo! Workbox didn't load 😬`);
}