diff --git a/packages/nitro/src/targets/sw/entry.ts b/packages/nitro/src/targets/sw/entry.ts index ffa520a9ea..e02d78428f 100644 --- a/packages/nitro/src/targets/sw/entry.ts +++ b/packages/nitro/src/targets/sw/entry.ts @@ -11,6 +11,16 @@ addEventListener('fetch', (event: any) => { event.respondWith(handleEvent(url, event.request)) }) +self.addEventListener('install', () => { + // @ts-ignore + self.skipWaiting() +}) + +self.addEventListener('activate', (event) => { + // @ts-ignore + event.waitUntil(self.clients.claim()) +}) + async function handleEvent (url, request) { try { const { html, status, headers } = await render(url.pathname, { req: request })