Adjust old sw.js file to remove itself, allowing new service-worker.js to be activated
This commit is contained in:
parent
543318dd8a
commit
ada17c4ba0
16
static/sw.js
Normal file
16
static/sw.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// Remove the service worker /sw.js from legacy installations
|
||||||
|
// This should then enable the new /service-worker.js to be installed
|
||||||
|
|
||||||
|
self.addEventListener('activate', function (e) {
|
||||||
|
console.log(`Unregistering service worker`)
|
||||||
|
self.registration.unregister()
|
||||||
|
.then(function () {
|
||||||
|
return self.clients.matchAll();
|
||||||
|
})
|
||||||
|
.then(function (clients) {
|
||||||
|
clients.forEach(client => {
|
||||||
|
console.log(`Navigating ${client.url}`)
|
||||||
|
client.navigate(client.url)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
@ -1,6 +1,6 @@
|
|||||||
import adapter from '@sveltejs/adapter-static';
|
import adapter from '@sveltejs/adapter-static';
|
||||||
|
|
||||||
export default {
|
const config = {
|
||||||
kit: {
|
kit: {
|
||||||
adapter: adapter({
|
adapter: adapter({
|
||||||
pages: 'build',
|
pages: 'build',
|
||||||
@ -11,3 +11,5 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
|
Loading…
Reference in New Issue
Block a user