22 lines
564 B
TypeScript
22 lines
564 B
TypeScript
import { defaultCache } from '@serwist/next/worker';
|
|
import type { PrecacheEntry, SerwistGlobalConfig } from 'serwist';
|
|
import { Serwist } from 'serwist';
|
|
|
|
declare global {
|
|
interface WorkerGlobalScope extends SerwistGlobalConfig {
|
|
__SW_MANIFEST: (PrecacheEntry | string)[] | undefined;
|
|
}
|
|
}
|
|
|
|
declare const self: WorkerGlobalScope & typeof globalThis;
|
|
|
|
const serwist = new Serwist({
|
|
precacheEntries: self.__SW_MANIFEST,
|
|
skipWaiting: true,
|
|
clientsClaim: true,
|
|
navigationPreload: true,
|
|
runtimeCaching: defaultCache,
|
|
});
|
|
|
|
serwist.addEventListeners();
|