Do app require workbox libaries to be precached or cached, since it precache size increases to ~4MB from ~2MB(which is not good I guess).
workbox-config.js
module.exports = {
"globDirectory":"build/",
"globPatterns":[
"**/*.{json,ico,png,jpg,html,js,css}",
],
"globIgnores":[
"workbox-v5.1.2/*",
"sw.js"
],
"swDest":"build/sw.js",
"swSrc":"src/sw.js",
}
You are not required to precache any resources that are fetched/imported (via fetch
or importScripts
) by the service worker itself. This non-requirement does not apply to asynchronous imports.
Only exception is Workbox Window.
In other words, if you're not using Workbox Window, then you can safely leave the line "workbox-v5.1.2/*"
in the "globIgnores"
, otherwise, something like this would cache Workbox Window only:
module.exports = {
"globDirectory":"build/",
"globPatterns":[
"**/*.{json,ico,png,jpg,html,js,css}",
],
"globIgnores":[
"workbox-v5.1.2/workbox-!(window)*",
"sw.js"
],
"swDest":"build/sw.js",
"swSrc":"src/sw.js",
}