Open Tommertom opened 1 year ago
@Tommertom you should file the issue on PWA SvelteKit integration repo not in docs repo
Anyway, if you're using latest kit, it seems to be broken, we're working to fix it (SvelteKit changes). You can modify your repo using kit 1.0.6 and try again, clear output folders.
We don't need to change anything in pwa kit integration, the pwa kit integration will generate pwa stuff on internal kit build output folder:
.sveltekit/output/client
folderIn some kit version (IIRC 1.3.2), Rich Harris changed kit internal build process
EDIT: using latest Vite (4.1) it seems we also need to fix vite plugin pwa since we're changing only the sequential hook, and we also need to change the order in build plugin:
PWABuildPlugin, check sequential closeBundle hook: kit pwa integration will provide that entry with pre
to allow run before kit adapter process:
export function BuildPlugin(ctx: PWAPluginContext) {
return <Plugin>{
name: 'vite-plugin-pwa:build',
enforce: 'post',
apply: 'build',
...
}
}
We need to change it to something like this (I have a local test for it):
export function BuildPlugin(ctx: PWAPluginContext) {
return <Plugin>{
name: 'vite-plugin-pwa:build',
enforce: ctx.userOptions?.integration?.closeBundleOrder ?? 'post',
apply: 'build',
...
}
}
Ok thx @userquin - I still need to raise this issue somewhere else?
So here I reckon ? https://github.com/vite-pwa/sveltekit
Ok thx @userquin - I still need to raise this issue somewhere else?
No
Hi
when running the SvelteKit guide to setup the plugin, you need to configure outDir to be "static" otherwise adapter static overwrites the sw+manifest generated to build.
And yo need to run the command basically twice, because adapter static apparently does not pick the resulting files anymore.
This how it works (almost) - generating to static so I can pick it up for build -
content of build: no sw.js and workbox-.js nor manifest. content of static: has sw.js and workbox-.js
Example repo - https://github.com/Tommertom/ionic-sveltekit-ssr-demo
Please note, this repo already has a manifest file in static (empty) for other reasons.