I'm trying to set up a simple Service Worker for a small static site, but I get a service worker console error:
sw.js:59 Uncaught TypeError: workbox.expiration.CacheableResponsePlugin is not a constructor
This is at the line new workbox.expiration.CacheableResponsePlugin
Any suggestions on how to fix this would be appreciated.
workbox.routing.registerRoute(
/\.(?:html)$/,
new workbox.strategies.NetworkFirst({
cacheName: 'html-cache',
plugins: [
new workbox.expiration.CacheableResponsePlugin({
statuses: [0, 200],
}),
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 5 * 60,
})
]
})
)