(pwa) vite pwa configuration

This commit is contained in:
Julien Calixte
2023-07-01 23:58:53 +02:00
parent 0855daf0bd
commit 6871e37214
12 changed files with 2044 additions and 125 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -1,4 +1,3 @@
import '@/registerServiceWorker'
import 'notyf/notyf.min.css'
import { createPinia } from 'pinia'

View File

@@ -1,36 +0,0 @@
/* eslint-disable no-console */
import { serviceWorkerBusEvent } from '@/bus/serviceWorkerEventBus'
import { register } from 'register-service-worker'
if (import.meta.env.NODE_ENV === 'production') {
register(`${import.meta.env.BASE_URL}service-worker.js`, {
ready() {
console.log(
'App is being served from cache by a service worker.\n' +
'For more details, visit https://goo.gl/AFskqB'
)
},
registered() {
console.log('Service worker has been registered.')
},
cached() {
console.log('Content has been cached for offline use.')
},
updatefound() {
console.log('New content is downloading.')
},
updated() {
console.log('New content is available; please refresh.')
serviceWorkerBusEvent.emit()
},
offline() {
console.log(
'No internet connection found. App is running in offline mode.'
)
},
error(error) {
console.error('Error during service worker registration:', error)
}
})
}