fix(pwa): make sure the service worker can be loaded (#1594)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
parent
82f06471cf
commit
0f695db325
15
src/sw.ts
15
src/sw.ts
@ -1,15 +0,0 @@
|
||||
/// <reference no-default-lib="true"/>
|
||||
/// <reference lib="esnext" />
|
||||
/// <reference lib="WebWorker" />
|
||||
|
||||
declare let self: ServiceWorkerGlobalScope
|
||||
import { precacheAndRoute, cleanupOutdatedCaches } from 'workbox-precaching'
|
||||
import { clientsClaim } from 'workbox-core'
|
||||
|
||||
// disable workbox logs
|
||||
self.__wb_disable_dev_logs = true
|
||||
cleanupOutdatedCaches() // cleanup everything that's not needed anymore
|
||||
|
||||
precacheAndRoute(self.__WB_MANIFEST) //cache our new stuff
|
||||
self.skipWaiting()
|
||||
clientsClaim()
|
@ -13,8 +13,6 @@ import { VitePWA, VitePWAOptions } from 'vite-plugin-pwa'
|
||||
|
||||
const PWAConfig: Partial<VitePWAOptions> = {
|
||||
registerType: 'autoUpdate',
|
||||
srcDir: 'src',
|
||||
filename: 'sw.ts',
|
||||
includeAssets: ['fonts/**/*.woff2', 'img/**/*.svg', 'img/**/*.png'],
|
||||
manifest: {
|
||||
name: 'Mainsail',
|
||||
|
Loading…
x
Reference in New Issue
Block a user