Is it possible to run Bun.js?

Is it possible to run Bun.js on Cloudflare Workers? Has anyone successfully implemented this?
4 Replies
Chaika
Chaika14h ago
You can use bun in build env/as a packager/etc. Actual deployed Cloudflare Workers run using the workerd runtime, which is tied to/uses Chromium's v8 javascript engine Cloudflare is working on a container platform where you could run bun, but for Workers Cloudflare manages the runtime and everything, and is all tied to V8. Workers are way more aimed at short running/inexpensive/async tasks anyway
seflanka
seflankaOP14h ago
Thanks for the explanation. I understand that Cloudflare Workers is tied to the V8 runtime and managed by Cloudflare itself. If I have JavaScript code written for Bun, would it still work if I deployed it to Workers with the V8 runtime? Or would I need to make significant modifications to make it compatible? I'm particularly interested in knowing if there are any Bun-specific APIs or features I'm using that might not work in Workers.
Hard@Work
Hard@Work14h ago
It depends on what exactly your script does. If it uses any bun-specific APIs at all, it won't work.
seflanka
seflankaOP14h ago
Thank you so much for your help and clarification!

Did you find this page helpful?