# Build Tools and Bundlers

> Use Vite (recommended) for dev servers and production builds, and understand what webpack, esbuild, Rollup and Turbopack do. Free notes, key concepts,...

Canonical: https://www.internhack.in/roadmaps/tracks/frontend/build-tools
Last updated: 2026-11-28

Use Vite (recommended) for dev servers and production builds, and understand what webpack, esbuild, Rollup and Turbopack do.

Intermediate · about 4 hours · difficulty 2/5

Learn first: [Package Managers](https://www.internhack.in/roadmaps/tracks/frontend/package-managers)

Browsers can run modules directly, but production apps still need a build step: to compile TypeScript and JSX, bundle hundreds of modules into efficient chunks, minify, hash filenames for caching and process CSS and images.

### What a build tool does

- **Dev server** with hot module replacement (HMR): edits appear instantly without losing state.
- **Transpiling**: TypeScript, JSX and newer syntax into what target browsers support.
- **Bundling and code splitting**: combine modules, split by route or dynamic import.
- **Tree shaking**: drop unused exports.
- **Minification and hashing**: `app.3f9a1c.js` can be cached forever because a change produces a new name.
- **Environment variables**: inject build-time config (only public values).

### The landscape

- **Vite** (recommended): serves native ESM in development for near-instant startup, uses a fast bundler for production and has a rich plugin ecosystem. It is the default for new React, Vue and Svelte projects.
- **webpack**: the long-time standard; hugely configurable with loaders and plugins. You will meet it in older or enterprise codebases.
- **esbuild**: an extremely fast Go-based bundler/transpiler, often used inside other tools.
- **Rollup**: excellent for libraries, with clean ESM output; its API inspired Vite's plugins.
- **Turbopack** and **Rspack**: Rust-based successors aimed at webpack-scale apps (Turbopack powers Next.js dev).

### Good enough to move on

You can scaffold a Vite project, explain what `vite build` outputs, add an environment variable, configure a path alias and inspect bundle size. Deep webpack configuration is something you learn when a job requires it.

## Key concepts

- **Vite**: Default for new SPA projects
- **webpack**: Common in existing codebases
- **esbuild**
- **Rollup**: Great for libraries
- **Turbopack and Rspack**
- **Dev server and HMR**
- **Transpiling and browser targets**
- **Tree shaking and code splitting**
- **Content hashing and minification**
- **Bundle analysis**

## Mini project

Move your vanilla modules project onto Vite, add an environment variable for the API base URL and a path alias, build it, and use a bundle visualiser plugin to find the largest dependency.

## Check yourself

Why can a file named app.3f9a1c.js be cached for a year while index.html should not be?

## Free resources

- [Vite Guide](https://vite.dev/guide/) (Vite)
- [webpack Concepts](https://webpack.js.org/concepts/) (webpack)
- [esbuild](https://esbuild.github.io/) (esbuild)

Previous: [Package Managers](https://www.internhack.in/roadmaps/tracks/frontend/package-managers) · Next: [Linting and Formatting](https://www.internhack.in/roadmaps/tracks/frontend/linting-formatting)

## More in Everyday Workflow and Tooling

- [Git and GitHub](https://www.internhack.in/roadmaps/tracks/frontend/git)
- [JavaScript Modules](https://www.internhack.in/roadmaps/tracks/frontend/js-modules)
- [Package Managers](https://www.internhack.in/roadmaps/tracks/frontend/package-managers)
- [Build Tools and Bundlers](https://www.internhack.in/roadmaps/tracks/frontend/build-tools)
- [Linting and Formatting](https://www.internhack.in/roadmaps/tracks/frontend/linting-formatting)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Frontend Developer Roadmap](https://www.internhack.in/roadmaps/tracks/frontend)
