-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Bundle a standalone executable #441
Comments
+1 pkg creates a 30-40MB executable for a simple console.log. Would be hugely awesome if we could create smaller executables. |
Size of executables from |
sounds great |
@SrBrahma @felix-schindler AFAIK pkg and |
@not-pope Doubt anybody expects that. But perhaps the bundled jscore runtime can be stripped of any isolatable components that the project is not using. For example multiprocessing feature set, which is commonly not being used. |
This is exactly what I also had in mind when I saw this. I have Nodejs deployments on Windows and it'd be a deal breaker since the environment doesn't allow for WSL to be run there. The best way would be to compile to exe, and since bun seems to compile code anyway, it'd be great if it can compile to executables straight away. I am not concerned by the size here since Nodejs, in this instance will be taking space anyway... The thing I'm interested is to see if it can be used to make standalone Executables for use in systems where it may not otherwise run properly, or just where we would use, say PKG to create executables. |
Highly wish for this. For me this is the edge Deno has on bun. if bun also gets the ability to package the entire project as a single executable, it will make it much easier to make the decision to use bun instead, as bun seems to do everything better than Deno anyway. |
Like nw.js, bun executable can be concated with .bun bundle file.
https://docs.nwjs.io/en/latest/For%20Users/Package%20and%20Distribute/ |
The (main) point here is not the executable size or the ability to "compile" javascript into machine code. The point here is the ability to create a single executable which "bundles" both bun and a project's js files, allowing easier distribution. |
Thanks to Dom (on Bun's Discord channel), that pointed me to github.com/theseyan/bkg. The @theseyan's strategy on bkg is very clean and it may be interesting in bring it into Bun itself in the near future. |
plans according to jarred is to have something like this in v0.8 related issue: #2541 inquiring about how the bun binary can be shrunk down (seems like it can't be shrunk super far) |
Available in 0.6.0, via the bun build --compile 🎉 |
@paperdave so amazing! Thanks for it! |
Does the actual source files gets transpiled to any other form in this compile process or they get bundled in executable as it is? |
it is like running |
Can anyone comment on how package size compares? |
@slapbox, here is a table with binary sizes on Linux, using The js source code is just a
My takeaway is:
|
I was wondering if there was a way to bundle your project together with bun into a standalone executable. Much like with
nexe
orpkg
for node.Given that bun is not widespread, but has the edge on performance, this could reduce a great deal of friction in the deployment of projects.
The text was updated successfully, but these errors were encountered: