After executing the create-react-app and enabling the service workers in the index.js
, all relevant files from the src
folder are cached. However some of my resources reside in the public
directory. When I run npm run build
, the asset-manifest.json
and precache-manifest.HASH.js
only contain the HTML, mangled JS and CSS (all stuff from the src
folder).
How can I tell the service worker to additionally cache specific files from the public
folder?
Here is the actually generated precache-manifest.e431838417905ad548a58141f8dc754b.js
self.__precacheManifest = [
{
"revision": "cb0ea38f65ed9eddcc91",
"url": "/grafiti/static/js/runtime~main.cb0ea38f.js"
},
{
"revision": "2c226d1577937984bf58",
"url": "/grafiti/static/js/main.2c226d15.chunk.js"
},
{
"revision": "c88c70e5f4ff8bea6fac",
"url": "/grafiti/static/js/2.c88c70e5.chunk.js"
},
{
"revision": "2c226d1577937984bf58",
"url": "/grafiti/static/css/main.7a6fc926.chunk.css"
},
{
"revision": "980026e33c706b23b041891757cd51be",
"url": "/grafiti/index.html"
}
];
But I want it to also contain entries for these urls:
/grafiti/icon-192.png
/grafiti/icon-512.png
They come from the public
folder.
Alternatively: How can I add my icons for the manifest.webmanifest
file in the src
folder in a way such that I can reference them from the web manifest?