How to cache api and assets in service worker in vue cli3
You have to use the "workboxOptions" inside the PWA Object of the vue.config.js.Like this:
module.exports = { pwa: { [...] workboxOptions: { runtimeCaching: [{ urlPattern: new RegExp('^https://yourpathtothe.api/'), handler: 'networkFirst', options: { networkTimeoutSeconds: 20, cacheName: 'api-cache', cacheableResponse: { statuses: [0, 200], }, }, }] } },