chore: update serviceWorker

This commit is contained in:
pipipi-pikachu 2022-06-01 23:44:26 +08:00
parent dd00189f24
commit 284b7b8045
3 changed files with 6 additions and 17 deletions

View File

@ -3,7 +3,7 @@
import { register } from 'register-service-worker'
if (process.env.NODE_ENV === 'production') {
register(`${process.env.BASE_URL}sw.js`, {
register(`${process.env.BASE_URL}service-worker.js`, {
ready() {
console.log(
'App is being served from cache by a service worker.\n' +

View File

@ -1,13 +0,0 @@
workbox.core.setCacheNameDetails({
prefix: 'pptist',
})
workbox.skipWaiting()
workbox.clientsClaim()
workbox.precaching.precacheAndRoute(self.__precacheManifest || [])
workbox.routing.registerRoute(
new RegExp('.*/.*'),
workbox.strategies.networkFirst()
)

View File

@ -71,9 +71,11 @@ module.exports = {
display: 'standalone',
background_color: '#000000',
},
workboxPluginMode: 'InjectManifest',
workboxOptions: {
swSrc: 'src/sw.js',
},
runtimeCaching: [{
urlPattern: new RegExp('.*'),
handler: 'networkFirst',
}],
}
},
}