Skip to content

Commit

Permalink
Merge pull request #93 from yeonjulee1005/stage
Browse files Browse the repository at this point in the history
🚗 [version: 1.30.0] push to master
  • Loading branch information
yeonjulee1005 authored Jan 5, 2024
2 parents 93dc084 + cc108df commit cff3517
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default defineNuxtConfig({
pwa: {
registerType: 'autoUpdate',
srcDir: './public/worker',
filename: 'sw.ts',
filename: 'serviceWorker.ts',
manifest: {
name: 'Dewdew',
short_name: 'Dewdew',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Dewdew",
"email": "yeonju.lee1005@gmail.com"
},
"version": "1.29.0",
"version": "1.30.0",
"private": true,
"scripts": {
"build": "nuxt build",
Expand Down
19 changes: 19 additions & 0 deletions public/worker/serviceWorker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { clientsClaim } from 'workbox-core'
import { precacheAndRoute, cleanupOutdatedCaches, createHandlerBoundToURL } from 'workbox-precaching';
import { registerRoute, NavigationRoute } from 'workbox-routing';

self.skipWaiting();
clientsClaim();
precacheAndRoute(self.__WB_MANIFEST);
cleanupOutdatedCaches();

//You can remove this code if you aren't precaching anything, or leave it in and live with the warning message
try {
const handler = createHandlerBoundToURL('/');
const route = new NavigationRoute(handler);
registerRoute(route);
} catch (error) {
console.warn('Error while registering cache route', { error });
}

//Your service-worker code here.

0 comments on commit cff3517

Please sign in to comment.