bun-plugin-svelte
The official [Svelte](https://svelte.dev/) plugin for [Bun](https://bun.com/).
## Installation
```sh
$ bun add -D bun-plugin-svelte
```
## Dev Server Usage
`bun-plugin-svelte` integrates with Bun's [Fullstack Dev Server](https://bun.com/docs/bundler/fullstack), giving you
HMR when developing your Svelte app.
Start by registering it in your [bunfig.toml](https://bun.com/docs/runtime/bunfig):
```toml
[serve.static]
plugins = ["bun-plugin-svelte"]
```
Then start your dev server:
```
$ bun index.html
```
See the [example](https://github.com/oven-sh/bun/tree/main/packages/bun-plugin-svelte/example) for a complete example.
## Bundler Usage
`bun-plugin-svelte` lets you bundle Svelte components with [`Bun.build`](https://bun.com/docs/bundler).
```ts
// build.ts
// to use: bun run build.ts
import { SveltePlugin } from "bun-plugin-svelte"; // NOTE: not published to npm yet
Bun.build({
entrypoints: ["src/index.ts"],
outdir: "dist",
target: "browser",
sourcemap: true, // sourcemaps not yet supported
plugins: [
SveltePlugin({
development: true, // turn off for prod builds. Defaults to false
}),
],
});
```
## Server-Side Usage
`bun-plugin-svelte` does not yet support server-side imports (e.g. for SSR).
This will be added in the near future.
## Not Yet Supported
Support for these features will be added in the near future
- Server-side imports/rendering
- Source maps
- CSS extensions (e.g. tailwind) in `