I met an issue where plugin is not loaded(no effect) when building with macros.
The plugin register
build.onLoad({filter: /\.email.svelte$/})
build.onResolve({filter:/\.email.svelte&email$/})
bunfig.toml
preload = ["./src/loadPlugin.ts"]
loadPlugin.ts
console.log("loading")
plugin(svelteEmailBunPlugin)
code
import * as Email from "./Test.email.svelte&email"
import {render} from "svelte/server";
export function prerender() {
const r = render(Email.default, {
props: {
name: "world",
message: "hello"
}
})
return r.body // r.css
}
import {prerender} from "./prerenderTest.ts" with {type: "macro"}
console.log(prerender())
Bun throws error
Error importing macro
error: Cannot find module "./Test.email.svelte&email"
It looks like plugin is not taking effect while build with macro.
The code works fine without with {type: "macro"}, however I'd like to have the email string at build time instead of runtime.