blob: f0a6e3419a1783b39b3c54752494ac3c0c710d23 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import { plugin } from "bun";
await plugin({
name: "svelte loader",
async setup(builder) {
var { compile } = await import("svelte/compiler");
var { readFileSync } = await import("fs");
await 2;
builder.onLoad({ filter: /\.svelte$/ }, ({ path }) => ({
contents: compile(readFileSync(path, "utf8"), {
filename: path,
generate: "ssr",
}).js.code,
loader: "js",
}));
await 1;
},
});
|