|
@@ -9,10 +9,10 @@
|
|
|
import { clientsClaim } from 'workbox-core'
|
|
import { clientsClaim } from 'workbox-core'
|
|
|
import {
|
|
import {
|
|
|
precacheAndRoute,
|
|
precacheAndRoute,
|
|
|
- cleanupOutdatedCaches
|
|
|
|
|
- // createHandlerBoundToURL
|
|
|
|
|
|
|
+ cleanupOutdatedCaches,
|
|
|
|
|
+ createHandlerBoundToURL
|
|
|
} from 'workbox-precaching'
|
|
} from 'workbox-precaching'
|
|
|
-// import { registerRoute, NavigationRoute } from 'workbox-routing'
|
|
|
|
|
|
|
+import { registerRoute, NavigationRoute } from 'workbox-routing'
|
|
|
|
|
|
|
|
self.skipWaiting()
|
|
self.skipWaiting()
|
|
|
clientsClaim()
|
|
clientsClaim()
|
|
@@ -22,13 +22,19 @@ precacheAndRoute(self.__WB_MANIFEST)
|
|
|
|
|
|
|
|
cleanupOutdatedCaches()
|
|
cleanupOutdatedCaches()
|
|
|
|
|
|
|
|
-// // Non-SSR fallback to index.html
|
|
|
|
|
-// // Production SSR fallback to offline.html (except for dev)
|
|
|
|
|
-// if (process.env.MODE !== 'ssr' || process.env.PROD) {
|
|
|
|
|
-// registerRoute(
|
|
|
|
|
-// new NavigationRoute(
|
|
|
|
|
-// createHandlerBoundToURL(process.env.PWA_FALLBACK_HTML),
|
|
|
|
|
-// { denylist: [/sw\.js$/, /workbox-(.)*\.js$/] }
|
|
|
|
|
-// )
|
|
|
|
|
-// )
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+// Non-SSR fallback to index.html
|
|
|
|
|
+// Production SSR fallback to offline.html (except for dev)
|
|
|
|
|
+if (process.env.MODE !== 'ssr' || process.env.PROD) {
|
|
|
|
|
+ registerRoute(
|
|
|
|
|
+ new NavigationRoute(
|
|
|
|
|
+ createHandlerBoundToURL(process.env.PWA_FALLBACK_HTML),
|
|
|
|
|
+ {
|
|
|
|
|
+ denylist: [
|
|
|
|
|
+ /api$/,
|
|
|
|
|
+ /sw\.js$/,
|
|
|
|
|
+ /workbox-(.)*\.js$/
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+}
|