aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ethan Steere <62357808+e253@users.noreply.github.com> 2023-09-08 16:19:53 -0400
committerGravatar GitHub <noreply@github.com> 2023-09-08 13:19:53 -0700
commitb5da5168bfceb7052015294bb01b83fe8d74869f (patch)
treea76df09debcfc7bb661090c8786c8eeab30f8d93
parent61569fab802eb3f894b308deec786ee08279d778 (diff)
downloadbun-b5da5168bfceb7052015294bb01b83fe8d74869f.tar.gz
bun-b5da5168bfceb7052015294bb01b83fe8d74869f.tar.zst
bun-b5da5168bfceb7052015294bb01b83fe8d74869f.zip
Update Svelte Kit Docs (#4541)
* Update Svelte Kit Docs I added some guidance about how to build for production. Still WIP since I would like to add a more complete deployment guide. * Formatting --------- Co-authored-by: Colin McDonnell <colinmcd94@gmail.com>
-rw-r--r--docs/guides/ecosystem/sveltekit.md55
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
+```