Modular programming is a software design technique whereby a program’s various functions are subdivided into code modules that are developed separately. Modern programming relies heavily on modularity, which is why you need a module bundler to merge all separate files into a single one.
What is esbuild, and why is it so fast?
Comparing esbuild to other bundlers (Benchmark)
To benchmark these bundlers, I’ll use the same criteria Wallace published to his GitHub repo. These figures may vary somewhat depending on the computer, but not by much.
The use case here is to duplicate the Three.js library 10 times and bundle it into one single file without any caches. The tests were done on a six-core 2019 MacBook Pro with 16gb of RAM.
The result of the benchmarking is mind-blowing: esbuild is 10 to 100 times faster than other bundlers, thanks to the Go language.
By the way, you can run this benchmark on your machine and see it for yourself. Install the Go language toolchain and run the following command:
Is esbuild production-ready?
There’s no disputing this bundler’s speed. But is it production-ready?
For now, esbuild is a small open-source project; it’s developed and maintained by one man. This is largely by design. Per the author: “I don’t personally want to run a large open-source project, so I’m not looking for contributions at this time.”
Even if esbuild is not yet production-ready, it’s something to keep an eye on. I highly recommend checking out the Github repo to dive deeper into the documentation.
Debugging code is always a tedious task. But the more you understand your errors the easier it is to fix them.