stiegi

stiegi

Opinions: replace esbuild with bun.js

As the title suggests, I’d like to hear your opinion of the idea to replace esbuild with bun.js, since it recently received its 1.0 release. The release trailer can be found here: https://www.youtube.com/watch?v=ThyMiimsAA0, more infos about bun you can find here: https://bun.sh/

For those who haven’t heard of it: bun is supposed to be a drop-in replacement for nodeJS and Deno. It as also a package manager so it replaces npm etc, and it comes with its own test suite. Written in Zik (https://ziglang.org/), it seems much faster than node and deno.

Now, I know that Phoenix switched to esbuild quite recently, however bun seems to outperform esbuild, and can also be used as a test framework and even as a runtime, in case you need some service written in JS. So, as it looks like, it would be everything esbuild is (a bundler) but faster, and more. There’s already support for many frameworks, and I think it would be great if you could spin up a Phoenix app, and combine it for example with a single page application of your choice out of the box.

What is your opinion about this? Would you prefer to stick with esbuild for now, or do you think it would make sense to switch again?

First 10 of 28 Posts Switch mode

wanton7

wanton7

I also read it supports TypeScript out of the box.

wanton7

wanton7

This was at Bun’s GitHub repo. So it’s not possible to replace esbuild now because Bun doesn’t have Windows support.

Windows users — Bun does not currently provide a native Windows build. We’re working on this; progress can be tracked at this issue. In the meantime, use one of the installation methods below for Windows Subsystem for Linux.

stiegi

stiegi OP

Yes I forgot about Typescript support and the Windows issue. Well, that will be solved at some point, and I also would not suggest you replace esbuild right with an 1.0 version anyway but wait a bit until first production experience reports are in. But given that windows support is there, and we can see in many places reports like “we switched from node to bun and it is awesome”, would you like to have the switch to bun then?

wanton7

wanton7

I’ve only used Phoenix LiveView for very small projects but sure I would be fine with that change.

LostKobrakai

LostKobrakai

Esbuild was chosen to lessen the node/npm related churn on the phoenix team. I personally wouldn’t see a switch to bun being helpful to that goal.

I’d love to see someone build a wrapper for downloading bun like the esbuild wrapper does it though.

11
Post #5
belaustegui

belaustegui

This has been on my mind since Bun released version 1.0. I’ve published a package today to integrate Bun with Elixir which is heavily based on the Esbuild package.

13
Post #6
zstzlmk

zstzlmk

Thank you, this is awesome.

belaustegui

belaustegui

Thank you! I hope that you find it useful :heart:

arcanemachine

arcanemachine

Doesn’t ESBuild support TS out of the box? I haven’t made any changes but I can automagically import my TS files as needed.

polypush135

polypush135

Well at least you are not asking for webpack :laughing:

I’ve pushed this rock before. I have in here everyday in the past complained how painful webpack was and that we should push to esbuild. I guess we have come full circle again.

I didn’t post this as a retort for asking to use bun.js but rather to say. It would look like every so many years that our asset tools evolve and we end up wanting to migrate. This clearly requires some effort on someones part and we should not just expect the core team to just want to pick up a new tool every few years.

Phoenix already does a good job at abstracting that pipeline for the most part.

The only thing I think that really keeps us coupled to this workflow is the trigger for watching a file so that it gets recompiled while running a dev server. “PhoenixLiveReload”

It would be nice to see phoenix in the future be completely static asset management agnostic and not come pre baked with any 3rd party lib for that.

This has been one of the biggest issues when working on any legacy app. The Node js libs that need to be managed in said tool cry because they are too out of date and no longer compatible.

Where Next?

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 91561 914
New
byu
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project. My initial shotgu...
New
arcanemachine
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
AstonJ
Just a general thread to post chat/news/info relating to AI/ML stuff that may be relevant for Nx now or in the future. Got anything to sh...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement