Skip to content

Bun build plugins in --compile mode #11895

@kravetsone

Description

@kravetsone

What is the problem this feature would solve?

Why plugins from Bun.build api not used in bun build --compile? I think it would be useful and convenient.

What is the feature you are proposing to solve the problem?

For example, we can add binary format or compile property in Bun.build or add new Bun.compile API with esbuild/Bun compability plugins

Bun.build({
	entrypoints: ["example/index.ts"],
	outdir: "out",

        format: "binary",
        // or
        compile: true,

	plugins: [
		autoload({
			pattern: "**/*.{ts,tsx,js,jsx,mjs,cjs}",
			directory: "./example/routes",
		}),
	],
});

What alternatives have you considered?

Compile already bundled code (An inconvenient unnecessary step)

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions