Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Bun build plugins in --compile mode #11895

Open
kravetsone opened this issue Jun 15, 2024 · 3 comments · May be fixed by #13619
Open

Bun build plugins in --compile mode #11895

kravetsone opened this issue Jun 15, 2024 · 3 comments · May be fixed by #13619
Labels
enhancement New feature or request

Comments

@kravetsone
Copy link

kravetsone commented Jun 15, 2024

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`;
@kravetsone kravetsone added the enhancement New feature or request label Jun 15, 2024
@ghost
Copy link

ghost commented Jun 16, 2024

i'm surprised it hasn't been implemented before

@ryoppippi
Copy link

OMG this is surprising for me too

@ryoppippi
Copy link

Not only compile mode, but also normal build command doesn't load plugin

@kravetsone kravetsone linked a pull request Aug 30, 2024 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants