Hi!
I wanted to make a simple hono server that would serve static files that would be packaged inside the executable produced by bun build --compile. I know this is "bleeding edge" and --compile isn't really ready yet but I really wanted to package an executable with bun and not with node due to the power and simpilicty bun introduces.
According to https://github.com/oven-sh/bun/issues/5445 there isn't a way to link a directory to be packaged. However files imported with type file were included in the executable.
That begs the question, can I somehow dynamically link a file to be included in the executable?
if (env.data.NODE_ENV == "production") {
const zip = await import("./dist/frontend.zip");
const unzipped =
unzipSync(new Uint8Array(await Bun.file(zip.default).arrayBuffer()))
}
The following code built with bun build --compile does include the frontend.zip inside, so it can be used. However the path to the zip file in my case is dynamic (dictated by .env).
So is there a way to import the file at compile time so it can be accessed with Bun.file? Maybe an --import flag would help followed by files to be imported or a special syntax so the compiler knows to replace said string with an env variable?