esbuild – An extremely fast JavaScript bundler and minifier

Interesting work by Evan Wallace, a JS bundler/minifier written in Go. Since it compiles down to native code, it’s fast:

My main benchmark approximates a large codebase by duplicating the three.js library 10 times and building a single bundle from scratch, without any caches. For this benchmark, esbuild is 10-100x faster than the other JavaScript bundlers I tested (Webpack, Rollup, Parcel, and FuseBox).

It supports quite a lot of stuff, but is not considered to cover it all:

This is a hobby project that I wrote over the 2019-2020 winter break. I believe that it’s relatively complete and functional. However, it’s brand new code and probably has a lot of bugs. It also hasn’t yet been used in production by anyone. Use at your own risk.

Example usage:

# Produces dist/entry_point.js and dist/entry_point.js.map
esbuild --bundle entry_point.js --outdir=dist --minify --sourcemap

Also works with React, with some extra CLI arguments:

esbuild example.jsx --bundle '--define:process.env.NODE_ENV="production"' --minify --outfile=out.js

esbuild

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.