import { register } from 'register-service-worker'
import pwa from '@vue/cli-plugin-pwa'
if (process.env.NODE_ENV === 'development') {
// if (process.env.NODE_ENV === 'production') {
console.log(pwa)
register(`${process.env.BASE_URL}service-worker.js`, {
ready () {
console.log(
'App is being served from cache by a service worker.\n'
)
},
cached () {
console.log('Content has been cached for offline use.')
},
updated () {
console.log('New content is available; please refresh.')
},
offline () {
console.log('No internet connection found. App is running in
offline mode.')
},
error (error) {
console.error('Error during service worker registration:', error)
}
})
}
I had attempted to apply my registerserviceworker.js code here in order to include files and APIs, however I encountered challenges and was unable to successfully add them.