urara
urara copied to clipboard
ServiceWorker doesn't work
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 antfu/vite-plugin-pwa#327.
But I might be able to create a temporary solution until it updates?
@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 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.
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)
@kwaa you have some reference for Vite, Rollup and Kit in the repo README file