Reputation: 1834
I'm trying to build my first PWA but I'm struggling to get things up and running. I've been adding the "GenerateSW" to my webpack.prod.js like so:
const { GenerateSW } = require('workbox-webpack-plugin');
...
plugins: [
...
new GenerateSW()
]
...
The build process generates a service-worker.js containing many entries, but from what I can see it does not contain the vendor.bundle.js
Should it contain all generated js files or is it correct that the vendor.bundle.js is missing? When launching the app I can find some pre-cached files in the "Cache Storage/workbox-precache-v2" but the vendor.bundle.js is also missing there. It contains the main.bundle.js though but when switching to offline and reloading the page I see that the main.bundle.js is also not getting loaded: main.bundle.js?06c1420d003c1b00a02a (failed) Is it because webpack adds a URL parameters when loading the bundle?
The PWA manifest also fails to load, probably because the service worker fails to start?
Upvotes: 1
Views: 1375
Reputation: 1834
I had to increase the filesize of objects to be pre-cached like this:
new GenerateSW({
maximumFileSizeToCacheInBytes : 5000000
})
Upvotes: 2