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

Support compile: boolean | "${platform}-${arch}" in Bun.build #13619

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Jarred-Sumner
Copy link
Collaborator

@Jarred-Sumner Jarred-Sumner commented Aug 30, 2024

What does this PR do?

This lets you programmatically invoke bun build --compile.

await Bun.build({
  entryPoints: ["./index.ts"],
  compile: true,
});

In this first version, only a single target can be specified per build. This limitation exists mostly because some code needs to be refactored to allow multiple concurrent cross compilations effectively (since we use custom --define for process.os and process.arch, that means we cannot reuse the same ASTs across builds).

Fixes: #11895

TODO before merging:

  • Write a couple tests
  • Figure out what to do about error messages / logs. it's not compiling right now.

How did you verify your code works?

@robobun
Copy link

robobun commented Aug 30, 2024

@Jarred-Sumner, your commit 3123df3 has some failures in #2538

@kravetsone
Copy link

Related - #11895

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

Successfully merging this pull request may close these issues.

Bun build plugins in --compile mode
4 participants