svelte-kit-bun
v0.5.0
Published
Experimental adapter for SvelteKit apps that compiles to a Bun single-file executable
Maintainers
Readme
@sveltejs/adapter-bun
Experimental. Adapter for SvelteKit apps that compiles the app into a Bun single-file executable. All static, prerendered, and server assets are embedded into the binary — the resulting file runs standalone with no external dependencies.
Requirements
- Bun >= 1.2.17 — the build and the resulting binary both run under Bun.
- SvelteKit >= 2.4.0.
Caveats
- No native (N-API) modules in single-file mode. Packages that ship
.nodeaddons (sharp,better-sqlite3,argon2,canvas, etc.) cannot be embedded in the executable. WASM works. Native addons do work if you setcompile: false. - Read-only filesystem (single-file mode). Embedded assets live in Bun's
$bunfs, which is read-only. Persist any user data outside the binary. - Not yet supported: service worker embedding, instrumentation hooks, socket activation.
Usage
// svelte.config.js
import adapter from '@sveltejs/adapter-bun';
export default {
kit: {
adapter: adapter()
}
};Run the build under Bun:
bun run buildOutput: build/app (single-file executable).
Skipping the executable
Set compile: false to emit build/entry.js and the asset tree without producing a standalone binary:
adapter({ compile: false });Then run bun run build/entry.js. This keeps native addons working and makes iteration faster at the cost of shipping Bun alongside the app.
