npm run build with SvelteKit's static adapter?Consider a SvelteKit project configured with the static adapter. You run npm run build. What is the expected output behavior?
Think about what a static adapter does compared to server adapters.
The static adapter pre-renders all pages at build time, producing static HTML files. This allows deployment to static hosts without a server.
svelte.config.js?Choose the correct way to import and configure the static adapter in svelte.config.js for SvelteKit.
Remember to call the adapter function when assigning it.
The static adapter must be imported and then called as a function to configure it properly.
prerender.entries configured?You have dynamic routes like [slug].svelte in your SvelteKit app. After building with the static adapter, those pages are missing. What is the cause?
Think about how static generation discovers pages to build.
The static adapter pre-renders pages it can find by crawling links or explicit entries. Dynamic routes need to be listed in prerender.entries to generate their pages.
import.meta.env.SSR during static adapter build and runtime?In a SvelteKit app using the static adapter, what does import.meta.env.SSR evaluate to during build and when running the static site in the browser?
Consider when SSR code runs and when client code runs.
import.meta.env.SSR is true during build because the app is rendered on the server. In the browser, it is false because the code runs client-side.
Given these deployment environments, which one is the best fit for a SvelteKit app built with the static adapter?
Think about what static adapter output is and where it can be hosted.
The static adapter produces static files that can be served by any static hosting or CDN without a server. Dynamic servers or serverless functions are not needed.