vite-pwa / sveltekit

Zero-config PWA Plugin for SvelteKit
https://vite-pwa-org.netlify.app/frameworks/sveltekit
MIT License
324 stars 15 forks source link

Server files being included by default - glob seems to not be functioning properly #86

Closed petermakeswebsites closed 3 months ago

petermakeswebsites commented 3 months ago

Attempting to build the service worker for some reason includes the server files, which throws an error at runtime.

It appears that the glob is defaulting to "server/.". When I tried to override by manually adding this to globIgnores, it still didn't work.

However, it did work when I changed to either server/**/* or server/**, suggesting that potentially this default glob isn't functioning properly?

"vite-plugin-pwa": "^0.20.1",
"@sveltejs/kit": "^1.30.4",
"vite": "^4.5.3",
"@vite-pwa/sveltekit": "^0.6.0",
"svelte": "^4.2.18",
            SvelteKitPWA({
                srcDir: "build",
                registerType: "prompt",
                mode: mode === "development" ? "development" : "production",
                workbox: {
                    cleanupOutdatedCaches: true,
                    inlineWorkboxRuntime: true,
                    maximumFileSizeToCacheInBytes: 1024 * 1024 * 1024,
                    globPatterns: ["**/*.{js,css,ico,png,svg,webp,woff,woff2,ttf}"],
                    // This is a little patch seems to correct the issue
                    globIgnores: ["server/**"],
                },
                strategies: "generateSW",
                includeAssets: [".well-known/assetlinks.json", "apple-app-site-association"],
                manifest: {
                    name: "name",
                    short_name: "name"
                    description: "desc",
                    theme_color: "#403053",
                    background_color: "#403053",
                    icons: [...
                    ],
                },
            })