mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 12:18:45 -05:00
service worker
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
"typescript": "^5.8.3",
|
||||
"vite": "6.3.5",
|
||||
"vite-plugin-pwa": "^1.0.1",
|
||||
"workbox-core": "^7.3.0",
|
||||
"workbox-build": "^7.3.0",
|
||||
"workbox-window": "^7.3.0",
|
||||
"workbox-background-sync": "^7.3.0",
|
||||
|
||||
@@ -4,12 +4,18 @@ import {registerRoute, setCatchHandler} from 'workbox-routing';
|
||||
import {CacheFirst, NetworkFirst, NetworkOnly, StaleWhileRevalidate} from 'workbox-strategies';
|
||||
import {ExpirationPlugin} from 'workbox-expiration';
|
||||
import {BackgroundSyncPlugin, Queue} from "workbox-background-sync";
|
||||
import { clientsClaim } from 'workbox-core'
|
||||
|
||||
|
||||
|
||||
cleanupOutdatedCaches()
|
||||
|
||||
declare let self: ServiceWorkerGlobalScope
|
||||
precacheAndRoute(self.__WB_MANIFEST)
|
||||
|
||||
self.skipWaiting()
|
||||
clientsClaim()
|
||||
|
||||
const OFFLINE_CACHE_NAME = 'offline-html';
|
||||
let script_name = typeof window !== 'undefined' ? localStorage.getItem('SCRIPT_NAME') : '/'
|
||||
var OFFLINE_PAGE_URL = script_name + 'offline/';
|
||||
|
||||
@@ -16,14 +16,10 @@ export default defineConfig({
|
||||
autoImport: true,
|
||||
}),
|
||||
VitePWA({
|
||||
registerType: 'autoUpdate',
|
||||
//registerType: 'autoUpdate',
|
||||
strategies: 'injectManifest',
|
||||
srcDir: 'src',
|
||||
filename: 'service-worker.ts',
|
||||
injectManifest: {
|
||||
swDest: "../cookbook/templates/sw.js",
|
||||
injectionPoint: undefined
|
||||
}
|
||||
})
|
||||
],
|
||||
resolve: {
|
||||
|
||||
@@ -3581,7 +3581,7 @@ workbox-cacheable-response@7.3.0:
|
||||
dependencies:
|
||||
workbox-core "7.3.0"
|
||||
|
||||
workbox-core@7.3.0:
|
||||
workbox-core@7.3.0, workbox-core@^7.3.0:
|
||||
version "7.3.0"
|
||||
resolved "https://registry.yarnpkg.com/workbox-core/-/workbox-core-7.3.0.tgz#f24fb92041a0b7482fe2dd856544aaa9fa105248"
|
||||
integrity sha512-Z+mYrErfh4t3zi7NVTvOuACB0A/jA3bgxUN3PwtAVHvfEsZxV9Iju580VEETug3zYJRc0Dmii/aixI/Uxj8fmw==
|
||||
|
||||
Reference in New Issue
Block a user