File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import type { PrecacheEntry , SerwistGlobalConfig } from "serwist" ;
2+ import { Serwist } from "serwist" ;
3+ import { defaultCache } from "@serwist/next/worker" ;
4+
5+ declare global {
6+ interface ServiceWorkerGlobalScope extends SerwistGlobalConfig {
7+ __SW_MANIFEST : ( PrecacheEntry | string ) [ ] | undefined ;
8+ }
9+ }
10+
11+ declare const self : ServiceWorkerGlobalScope ;
12+
13+ const serwist = new Serwist ( {
14+ precacheEntries : self . __SW_MANIFEST ,
15+ skipWaiting : true ,
16+ clientsClaim : true ,
17+ navigationPreload : true ,
18+ runtimeCaching : defaultCache ,
19+ } ) ;
20+
21+ serwist . addEventListeners ( ) ;
Original file line number Diff line number Diff line change 1- import withPWA from 'next-pwa ' ;
1+ import withSerwist from '@serwist/ next' ;
22
33/** @type {import('next').NextConfig } */
44const nextConfig = {
@@ -65,9 +65,8 @@ const nextConfig = {
6565 } ,
6666}
6767
68- export default withPWA ( {
69- dest : 'public' ,
68+ export default withSerwist ( {
69+ swSrc : 'app/sw.ts' ,
70+ swDest : 'public/sw.js' ,
7071 disable : process . env . NODE_ENV === 'development' ,
71- register : true ,
72- skipWaiting : true ,
7372} ) ( nextConfig ) ;
Original file line number Diff line number Diff line change 2929 "lang-detector" : " ^1.0.6" ,
3030 "lottie-react" : " ^2.4.1" ,
3131 "next" : " ^15.5.15" ,
32- "next-pwa" : " ^5.6.0" ,
32+ "@serwist/next" : " ^9.0.0" ,
33+ "serwist" : " ^9.0.0" ,
3334 "openpgp" : " ^6.2.2" ,
3435 "papaparse" : " ^5.5.3" ,
3536 "parse-torrent" : " ^11.0.19" ,
Original file line number Diff line number Diff line change 33 "lib" : [
44 " dom" ,
55 " dom.iterable" ,
6- " esnext"
6+ " esnext" ,
7+ " webworker"
78 ],
89 "allowJs" : true ,
910 "skipLibCheck" : true ,
You can’t perform that action at this time.
0 commit comments