Fix service worker (#2433)

Regression from #2267.

This fixes the service-worker and switches from injecting the manifest
into a pre-provided service-worker to generating the service-worker
during webpack builder.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
pull/2436/head
Florian Hotze 2024-02-29 12:30:29 +01:00 committed by GitHub
parent ea28f32140
commit 5159566e02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 7 deletions

View File

@ -265,9 +265,13 @@ module.exports = {
]
}),
...(env === 'production' ? [
new WorkboxPlugin.InjectManifest({
swSrc: resolvePath('src/service-worker.js'),
new WorkboxPlugin.GenerateSW({
swDest: 'service-worker.js',
maximumFileSizeToCacheInBytes: 100000000,
// these options encourage the ServiceWorkers to get in there fast
// and not allow any straggling "old" SWs to hang around
clientsClaim: true,
skipWaiting: true
})
] : []),
...(env === 'production' ? [

View File

@ -3,7 +3,7 @@
"allowSyntheticDefaultImports": false,
"baseUrl": "./",
"paths": {
"@/*": ["src/*"],
"@/*": ["src/*"]
}
},
"exclude": ["node_modules", "node", "build", "assets-src", "www", "test"]

View File

@ -326,7 +326,7 @@ export default {
// Register service worker
serviceWorker: (location.hostname === 'localhost') ? {} : {
path: '/service-worker.js'
path: './service-worker.js'
},
card: {
swipeToClose: true

View File

@ -1,3 +0,0 @@
// manifest import and workbox imports will be autogenerated by webpack
// eslint-disable-next-line no-undef
workbox.precaching.precacheAndRoute(self.__WB_MANIFEST)