🌐 Web Development

Bundler

Bundler

A tool that combines multiple files into one. Webpack, Vite, esbuild, and others. Central to frontend builds.

Detailed Explanation

A bundler is a tool that combines multiple JavaScript files and modules into one (or several) files. It performs dependency resolution, code transformation, and optimization.

Code Example

# Create a Vite project npm create vite@latest my-app # Dev server (ES modules, no bundling) npm run dev # Production build (bundling + optimization) npm run build # → dist/assets/index-[hash].js

Practical Conversation Example

Junior

"Why do we need a bundler? Can't we just split modules with import/export?"

Senior

"If the browser has to request hundreds of files one by one, it's slow. A bundler combines and optimizes them, and also removes unused code with Tree Shaking."

Related Terms

Learn More