I have two projects here:
- Created using
npm create vite app-with-svelte -- -t svelte-ts
- Created using
npm create svelte app-with-sveltekit
(Skeleton project)
Then, I use the static adapter with it, following this doc. Eventually, svelte.config.js
:
import adapter from "@sveltejs/adapter-static"; import { vitePreprocess } from "@sveltejs/vite-plugin-svelte"; const config = { preprocess: vitePreprocess(), kit: { adapter: adapter({ pages: "build", assets: "build", fallback: undefined, precompress: false, strict: true, }), }, }; export default config;
src/routes/+layout.ts
:
export const prerender = true;
Both projects are aimed to host as static files. Is any one of these better than the other?
I created a project using SvelteKit static adapter with Neutralino. From the middle of the way, I got stuck with Compatibility with SvelteKit (Neutralino issue), forcing me to use Svelte. So I searched for migrating SvelteKit to Svelte, found a reddit tweet:
There's no need to migrate away from kit. Look up
@sveltejs/adapter-static
. It should solve your issue
After npm run build
, are Svelte and SvelteKit static adapter the same? If so, which one should I use?