forked from external-repos/squoosh
Correct service worker name
This commit is contained in:
@@ -112,7 +112,9 @@ export default async function ({ watch }) {
|
|||||||
plugins: [
|
plugins: [
|
||||||
{ resolveFileUrl, resolveImportMeta },
|
{ resolveFileUrl, resolveImportMeta },
|
||||||
OMT({ loader: await omtLoaderPromise }),
|
OMT({ loader: await omtLoaderPromise }),
|
||||||
serviceWorkerPlugin({ output: 'static/sw.js' }),
|
serviceWorkerPlugin({
|
||||||
|
output: 'static/serviceworker.js',
|
||||||
|
}),
|
||||||
...commonPlugins(),
|
...commonPlugins(),
|
||||||
commonjs(),
|
commonjs(),
|
||||||
resolve(),
|
resolve(),
|
||||||
|
|||||||
14
src/copy/sw.js
Normal file
14
src/copy/sw.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
// I accidentally shipped with the wrong service worker name.
|
||||||
|
// This picks up users that still might be using that version.
|
||||||
|
// We'll be able to delete this file eventually.
|
||||||
|
|
||||||
|
addEventListener('install', () => {
|
||||||
|
skipWaiting();
|
||||||
|
});
|
||||||
|
addEventListener('activate', async () => {
|
||||||
|
await self.registration.unregister();
|
||||||
|
const allClients = await clients.matchAll({
|
||||||
|
includeUncontrolled: true,
|
||||||
|
});
|
||||||
|
for (const client of allClients) client.navigate('/');
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user