Workbox precache does not cache manifest-[chunk].js file for offline PWA

103 views Asked by At

I am working on implementing a offline mode PWA for an app.

I set up a workbox InjectManifest in webpack and everything seems to precache just fine. The only precache file that is missing however is manifest-[chunk-hash].js.

Webpack is set up so that it chunks up the JS file into different pieces. So I have a lets say page-[chunk-hash].js, test-[chunk-hash].js, etc. All these files as well as index.html and assets get precached in Cache Storage just fine. Except for the manifest js file.

Why is this happening? I also included exclude: [] in the Inject manifest, and during build says the correct number of urls is cached. But It doesn't actually show up in the cache? Why?

example of the injectManifest in webpack config

   new WorkboxPlugin.InjectManifest({
                swSrc: path.resolve(__dirname, 'public/src-sw.js'),
                swDest: path.resolve('./apps/pwaTest/service-worker.js'),
                exclude: [] 
            }),

I tried adding the exclude: [] option like others have mentioned. This does show the correct number of urls were cahced on build. However, it doesn't actually show in cache. For example, it says 8 urls were precached, but only 7 shows up in the cache. The missing one is manifest-[chunk].js

0

There are 0 answers