mirror of
https://github.com/jcreek/LivingDexTracker.git
synced 2026-09-14 17:42:17 +00:00
fix(pwa): honour the adapter flag and precache an offline entry point
Three defects that together meant `npm run test:build` could not pass in any of its four variants: - svelte.config.js constructed adapter-netlify inline and never used the `adapter` export from adapter.mjs, so NODE_ADAPTER=true still produced a flat build/ directory while the build test expects the node adapter's build/client layout. adapter.mjs now returns netlify (the deployment target) or node, and svelte.config.js consumes it. - No route is prerendered, so workbox's glob found no HTML document and a generateSW build precached nothing navigable: the app had no offline support in that mode at all. Adds the root entry and a navigation fallback, matching what prompt-sw.ts already did by hand for injectManifest builds. - The build scripts used by the tests skipped the tailwind step that `build` runs, so static/output.css was never generated on a clean checkout and the app under test had no stylesheet. The offline entry point assertion now also accepts the unquoted object key that prompt-sw.ts's own precache call survives minification as.
This commit is contained in:
+3
-11
@@ -1,7 +1,7 @@
|
||||
import adapter from '@sveltejs/adapter-netlify';
|
||||
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
||||
// you don't need to do this if you're using generateSW strategy in your app
|
||||
import { generateSW } from './pwa.mjs';
|
||||
import { adapter } from './adapter.mjs';
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = {
|
||||
@@ -10,16 +10,8 @@ const config = {
|
||||
preprocess: vitePreprocess(),
|
||||
|
||||
kit: {
|
||||
adapter: adapter({
|
||||
// if true, will create a Netlify Edge Function rather
|
||||
// than using standard Node-based functions
|
||||
edge: false,
|
||||
|
||||
// if true, will split your app into multiple functions
|
||||
// instead of creating a single one for the entire app.
|
||||
// if `edge` is true, this option cannot be used
|
||||
split: false
|
||||
}),
|
||||
// Netlify by default, or the node adapter when NODE_ADAPTER=true. See adapter.mjs.
|
||||
adapter,
|
||||
serviceWorker: {
|
||||
register: true
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user