What are Svelte compile options and configuration?
Answer
Svelte is configured in svelte.config.js at the project root. Key options: kit.adapter: deployment adapter. kit.alias: path aliases (e.g., $lib maps to src/lib by default). kit.csrf: CSRF protection for form actions (enabled by default). kit.paths.base: base path for deploying to a subdirectory. compilerOptions: Svelte compiler options — runes: true (opt-in to Svelte 5 runes mode), accessors: true (generate getters/setters for all component props). Vite configuration is in vite.config.js. The src/app.html is the HTML template — add global head tags, meta, and the body placeholder %sveltekit.body%. TypeScript is configured with tsconfig.json — SvelteKit generates a tsconfig.json based on your config. src/app.d.ts defines TypeScript types for Locals, PageData, and Platform.
Previous
How do you implement error handling in SvelteKit?
Next
How does Svelte 5's reactivity model with $state differ from Svelte 4?
More Svelte / SvelteKit Questions
View all →- Intermediate What are Svelte custom stores and the store contract?
- Intermediate How does SSR (Server-Side Rendering) work in SvelteKit?
- Intermediate What are SvelteKit adapters?
- Intermediate What is the difference between prerendering, SSR, and CSR in SvelteKit?
- Intermediate How do you manage environment variables in SvelteKit?