diff --git a/README.md b/README.md index 080f691..b87ebf3 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ The integration accepts a configuration object of type `ServiceWorkerConfig` wit ## Example sw.js -You can find an example service worker (`example_sw.js`) in the [repository](https://ayco.io/gh/astro-sw). +You can find an example service worker (`src/example_sw.js`) in the [repository](https://ayco.io/gh/astro-sw). ## Background diff --git a/astro.config.mjs b/astro.config.mjs index 3571d5f..5b6638d 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -10,7 +10,7 @@ export default defineConfig({ site: 'https://ayo.ayco.io', integrations: [ serviceWorker({ - path: './example_sw.js', + path: './src/example_sw.js', customRoutes: [ // '/threads' ], diff --git a/example_sw.js b/src/example_sw.js similarity index 96% rename from example_sw.js rename to src/example_sw.js index 3202505..5f427c8 100644 --- a/example_sw.js +++ b/src/example_sw.js @@ -1,4 +1,4 @@ -import { log } from "./src/utils"; +import { log } from "./utils"; /** * Note: @ayco/astro-sw integration injects variables `__prefix`, `__version`, & `__assets` @@ -78,9 +78,7 @@ self.addEventListener('activate', (event) => { self.addEventListener('install', (event) => { console.log('installing...', event) event.waitUntil( - addResourcesToCache([ - ...(__assets ?? []) - ]) + addResourcesToCache(__assets ?? []) ); });