diff options
-rw-r--r-- | docs/guides/ecosystem/sveltekit.md | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/docs/guides/ecosystem/sveltekit.md b/docs/guides/ecosystem/sveltekit.md index 5cfd2b5ee..77ca3c624 100644 --- a/docs/guides/ecosystem/sveltekit.md +++ b/docs/guides/ecosystem/sveltekit.md @@ -63,3 +63,58 @@ Visit [http://localhost:5173](http://localhost:5173/) in a browser to see the te --- If you edit and save `src/routes/+page.svelte`, you should see your changes hot-reloaded in the browser. + +--- + +To build for production, you'll need to add the right SvelteKit adapter. Currently we recommend the + +`bun add -D svelte-adapter-bun`. + +Now, make the following changes to your `svelte.config.js`. + +```ts +- import adapter from "@sveltejs/adapter-auto"; ++ import adapter from "svelte-adapter-bun"; +import { vitePreprocess } from "@sveltejs/kit/vite"; + +/** @type {import('@sveltejs/kit').Config} */ +const config = { + kit: { + adapter: adapter(), + }, + preprocess: vitePreprocess(), +}; + +export default config; +``` + +--- + +To build a production bundle: + +```sh +$ bun run build + $ vite build + +vite v4.4.9 building SSR bundle for production... +transforming (60) node_modules/@sveltejs/kit/src/utils/escape.js + +✓ 98 modules transformed. +Generated an empty chunk: "entries/endpoints/waitlist/_server.ts". + +vite v4.4.9 building for production... +✓ 92 modules transformed. +Generated an empty chunk: "7". +.svelte-kit/output/client/_app/version.json 0.03 kB │ gzip: 0.05 kB + +... + +.svelte-kit/output/server/index.js 86.47 kB + +Run npm run preview to preview your production build locally. + +> Using svelte-adapter-bun + ✔ Start server with: bun ./build/index.js + ✔ done +✓ built in 7.81s +``` |