Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

📘: add info about elysia-autoload Bun.build in plugins #345

Merged
merged 2 commits into from
Jul 26, 2024

Conversation

kravetsone
Copy link
Contributor

Bun build usage

You can use this plugin with Bun.build, thanks to esbuild-plugin-autoload!

// @filename: build.ts
import { autoload } from "esbuild-plugin-autoload"; // default import also supported

await Bun.build({
    entrypoints: ["src/index.ts"],
    outdir: "out",
    plugins: [autoload()],
}).then(console.log);

Then, build it with bun build.ts and run with bun out/index.ts.

Bun compile usage

You can bundle and then compile it into a single executable binary file

import { autoload } from "esbuild-plugin-autoload"; // default import also supported

await Bun.build({
    entrypoints: ["src/index.ts"],
    outdir: "out",
    plugins: [autoload()],
}).then(console.log);

await Bun.$`bun build --compile out/index.js`;

Warning

You cannot use it in bun build --compile mode without extra step (Feature issue)

Read more

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants