I use GenerateSw class for my worker generation. It works fine, but i need to precache some resources that not handled by webpack for offline page, so i use:
additionalManifestEntries: [
'/offline',
'https://static.express/img/laksjhdaskldfjlaljsafsp/connection-lost.svg'
]
but i'm facing this warnings, even though mode property is set to prod.
Question: Can i hide them?
You can avoid these warnings by switching to objects with
url:
properties, andrevision: null
properties for each, to indicate that they are already uniquely revisioned based on their URLs.But... if you do that, and your URLs don't actually contain any unique revision information in them, then your users will end up "stuck" with an old copy of, e.g.,
/offline
indefinitely, even when you make changes to/offline
and redeploy. That's why Workbox makes it "hard" to do this.A better approach for caching additional URLs is to set up a runtime caching route that will use a specific strategy on them, and potentially "warm" that strategy cache using these techniques. Using, e.g., a
StaleWhileRevalidate
strategy for those URLs will ensure that they will eventually be updated.