umma.dev

Vite/es-build/Webpack/Parcel/rollup.js

Looking into how JavaScript bundlers differ and which one would be the most benefical when creating an application.

Vite

Vite has been built on top of es-build. What makes Vite a popular choice is the slower server start; it splits modules in the application into dependencies and source code.

If Vite is built on es-build, why not just go straight to es-build?! Well according to their docs…

“While esbuild is extremely fast and is already a very capable bundler for libraries, some of the important features needed for bundling applications are still work in progress - in particular code-splitting and CSS handling. For the time being, Rollup is more mature and flexible in these regards. That said, we won’t rule out the possibility of using esbuild for production builds when it stabilizes these features in the future.”

es-build

This is by far one of the most fastest and most efficent options around. In comparsion to webpack and parcel, it’s a great choice because the bundle size is kept small. There is no need to cache and it support small major features for JavaScript and TypeScript.

Webpack

Webpack is a pretty standard bundler, it does what you need it to do and is compatible in many areas. It lacks in performance and speed though.

Parcel

Parcel’s documentation is good, so it’s great if you want to dive into bundlers and don’t want to use webpack. It’s also great when it comes to error handling.

There are lots of positives:

  • Zero config
  • Dev server
  • Hot reloading
  • Reliable caching

rollup.js

A popular choice seen from The State of JS 2022. There are a number of benefits, such as smaller slef-contained files with specific responsibilities, watch option for re-run of bundling, linting, syntax checks, unsed functions are removed automatically via tree-shaking methods thus improving performance with small file sizes.