includes vite-plugin-pwa and @vite-pwa/sveltekit to allow use sw in dev server (configured by default)
update all depdenencies to latest versions
use ts, also in the service worker
the service worker includes nostr-tools (requires patch node readable-stream package: see postinstall script in package.json and scripts/patch.ts module: will not be reuqired once fixed, see https://github.com/nodejs/readable-stream/issues/487)
The project will require Node 16.14+, SvelteKit requires at leat this version.
Node version should be managed with NVM, once installed a LTS version (I use 16.17.0) and selected in NVM, you must enable corepack: you can read https://github.com/antfu/contribute
To install dependencies just run pnpm install, to run scripts pnpm <script-name> or pnpm run <script-name>.
Use always a private window in chrome (or chromium based browser) when using dev server, this way the sw will be removed once the windows is closed.
By default, the applciation is configured to allow use the sw in development, and so, you can just make changes to the sw and once saved the application will be reloaded with the new one containing the chages (I have configured prompt for update, you can just ignore it, the sw is updated and your assets also reloaded, since they are not intercepted by the sw).
This behavior can be disabled. I will try to provide some stuff to allow start the dev server with or without the dev options of pwa plugin enabled.
About local pwa plugin stuff: I just include the vite-plugin-pwa with the fix to allow change the Rollup build type and the new SvelteKit integration (Rollup sequential hook).
Once the pwa plugin and the kit integration publised, just remove both dependencies and install the kit integration:
pnpm remove -D @vite-pwa/sveltekit
pnpm remove -D vite-plugin-pwa
pnpm add -D @vite-pwa/sveltekit: will install also the vite-plugin-pwa, it is a peer dependency
remove both tgz files
I've also patched the vite-plugin-pwa since there is 2 separated PR for iife and for Vite 3.1 (and we need last one for kit integration).
This PR also includes:
vite-plugin-pwa
and@vite-pwa/sveltekit
to allow use sw in dev server (configured by default)nostr-tools
(requires patch nodereadable-stream
package: seepostinstall
script inpackage.json
andscripts/patch.ts
module: will not be reuqired once fixed, see https://github.com/nodejs/readable-stream/issues/487)The project will require Node 16.14+, SvelteKit requires at leat this version.
Node version should be managed with NVM, once installed a LTS version (I use 16.17.0) and selected in NVM, you must enable corepack: you can read https://github.com/antfu/contribute
To install dependencies just run
pnpm install
, to run scriptspnpm <script-name>
orpnpm run <script-name>
.Use always a private window in chrome (or chromium based browser) when using dev server, this way the sw will be removed once the windows is closed.
By default, the applciation is configured to allow use the sw in development, and so, you can just make changes to the sw and once saved the application will be reloaded with the new one containing the chages (I have configured prompt for update, you can just ignore it, the sw is updated and your assets also reloaded, since they are not intercepted by the sw).
This behavior can be disabled. I will try to provide some stuff to allow start the dev server with or without the dev options of pwa plugin enabled.
About local pwa plugin stuff: I just include the
vite-plugin-pwa
with the fix to allow change the Rollup build type and the new SvelteKit integration (Rollup sequential hook).Once the pwa plugin and the kit integration publised, just remove both dependencies and install the kit integration:
pnpm remove -D @vite-pwa/sveltekit
pnpm remove -D vite-plugin-pwa
pnpm add -D @vite-pwa/sveltekit
: will install also thevite-plugin-pwa
, it is a peer dependencyI've also patched the vite-plugin-pwa since there is 2 separated PR for
iife
and forVite 3.1
(and we need last one for kit integration).