Is it possible to run Bun.js?
Is it possible to run Bun.js on Cloudflare Workers? Has anyone successfully implemented this?
4 Replies
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
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.
It depends on what exactly your script does. If it uses any bun-specific APIs at all, it won't work.
Thank you so much for your help and clarification!