File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -52,5 +52,21 @@ $(async (): Promise<void> => {
5252 void registration . unregister ( ) ;
5353 }
5454 } ) ;
55+ } else {
56+ if ( "serviceWorker" in navigator ) {
57+ window . addEventListener ( "load" , ( ) => {
58+ navigator . serviceWorker
59+ . register ( "/sw.js" , { scope : "/" } )
60+ . then ( ( registration ) => {
61+ console . log (
62+ "ServiceWorker registration successful with scope: " ,
63+ registration . scope
64+ ) ;
65+ } )
66+ . catch ( ( error : unknown ) => {
67+ console . error ( "ServiceWorker registration failed: " , error ) ;
68+ } ) ;
69+ } ) ;
70+ }
5571 }
5672} ) ;
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ export default {
9090 ViteMinifyPlugin ( { } ) ,
9191 VitePWA ( {
9292 // injectRegister: "networkfirst",
93- injectRegister : "script-defer" ,
93+ injectRegister : null ,
9494 registerType : "autoUpdate" ,
9595 manifest : {
9696 short_name : "Monkeytype" ,
You can’t perform that action at this time.
0 commit comments