Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I think this will not work anymore #4

Open
dnotes opened this issue Sep 3, 2022 · 0 comments
Open

I think this will not work anymore #4

dnotes opened this issue Sep 3, 2022 · 0 comments

Comments

@dnotes
Copy link
Contributor

dnotes commented Sep 3, 2022

With recent changes to SvelteKit, the service worker build process no longer gets modified by Vite plugins or configuration (see here for example) so I don't think this package will work anymore. Instead you can do something like the following in src/service-worker.js:

import { build, files, prerendered, version } from '$service-worker'
import { precacheAndRoute, type PrecacheEntry } from 'workbox-precaching'

let cacheEntries:PrecacheEntry[] = [
  ...build,
  ...files,
  ...prerendered,
].map(url => ({ url, revision: version }))
precacheAndRoute(cacheEntries)

// ...etc.

Also until sveltejs/kit#6329 lands you'll have to manually replace all of the Workbox-generated process.env.NODE_ENV calls in the service worker file after it is built.

It was good while it lasted. Thanks. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant