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

ServiceWorker doesn't work #34

Closed
kwaa opened this issue Sep 2, 2022 · 4 comments
Closed

ServiceWorker doesn't work #34

kwaa opened this issue Sep 2, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@kwaa
Copy link
Member

kwaa commented Sep 2, 2022

ServiceWorker files are not automatically copied to ./build after updating to the latest versions of SvelteKit and Vite.

Progress tracking here, looks like need to wait for vite-pwa/vite-plugin-pwa#327.

But I might be able to create a temporary solution until it updates?

@kwaa kwaa added the bug Something isn't working label Sep 2, 2022
@userquin
Copy link

userquin commented Sep 4, 2022

@kwaa you can check this repo, I just hack the vite-plugin-pwa with a local copy of the plugin using the linked PR: https://github.com/userquin/pwa-sveltekit-vite

EDIT: you will need to download the tgz to your local and install it as a dev dependency: pnpm remove -D vite-plugin-pwa && pnpm add -D ./vite-plugin-pwa-0.12.3.tgz, then, modify your vite.config.js using th eone in the repo.

@kwaa
Copy link
Member Author

kwaa commented Sep 4, 2022

@kwaa you can check this repo, I just hack the vite-plugin-pwa with a local copy of the plugin using the linked PR: https://github.com/userquin/pwa-sveltekit-vite

Oh, thanks!
I noticed that, except the code was a bit hard to read.

@userquin
Copy link

userquin commented Sep 4, 2022

the vite plugin pwa is built using Vite 2, so we just get the 3 plugins destructuring the array: we only need to register a new one for the pwa build plugin using the new Vite 3/ Rollup sequential hook and change the order to just run before the kit one (closeBundle hook in kit plugin will run the adapter, and so, we only need to run it before the kit one with the sequential enabled)

@userquin
Copy link

userquin commented Sep 4, 2022

@kwaa you have some reference for Vite, Rollup and Kit in the repo README file

@kwaa kwaa closed this as completed in fcf49af Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants