-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
SvelteKit + adapter Static requires outDir="static" #29
Comments
@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:
In 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 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 |
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.
The text was updated successfully, but these errors were encountered: