'workbox-webpack-plugin InjectManifest missing vendor.js
I'm using workbox-webpack-plugin's InjectManifest to generate the __WB_MANIFEST list, for precacheAndRoute in the service-worker.js.
But I found that the vendor.xxx.js was not in list (common.js、runtime.js no problem).
So the serviceWorker won't cache it successfully.
__WB_MANIFEST: enter image description here
network: enter image description here
Btw, it is in the webpack's manifest.json file.
And I had turn up the maximumFileSizeToCacheInBytes config over the vendor's size.
But it still doesn't work.
🙏🙏
webpack.config.js:
plugins: [
new InjectManifest({
swSrc: './service-worker/service-worker.js',
maximumFileSizeToCacheInBytes: 10485760, // 10M
})
]
service-worker.js:
import { precacheAndRoute } from 'workbox-precaching';
const precacheList = self.__WB_MANIFEST || [];
precacheAndRoute(precacheList, {
cleanURLs: false,
});
self.addEventListener('install', (event) => {
self.skipWaiting();
});
self.addEventListener('activate', (event) => {
self.clients.claim();
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
