# webpack

> A well-known JavaScript bundler. It does a lot, but it is slow to set up.

**Field:** Software Development  
**Category:** Web Development  
**Also known as:** Webpack, webpack.js

## Think of it like

Think of it like a big old factory with a dial for each job. It can make most things, once set up.

## Definition

webpack is a JavaScript bundler, first released in 2012. It shaped how web apps are built. It reads a config file that says where the code starts and where the bundle goes. Plugins and loaders let it handle CSS, images, TypeScript and more. It is very flexible but can be slow and hard to set up. Many older projects still use it.

## Example

Lucy joins a team whose app has used webpack since 2017. Its config file is 300 lines long.

## Example code

```javascript
module.exports = {
  entry: "./src/index.js",
  output: { filename: "bundle.js" },
};
```

Start at index.js and put all the code into one file, bundle.js.

## Why it matters

A huge number of existing apps are built with webpack. You will likely meet it.

## Common mistake

Copying config snippets you do not understand. The file grows until nobody dares to touch it.

## Three principles

- **One config file.** Says where code starts and ends.
- **Loaders and plugins.** Handle CSS, images and more.
- **Flexible but heavy.** Slower than newer tools.

## Related terms

- [JavaScript Bundler](https://learn.benibix.com/term/development/bundler)
- [Vite](https://learn.benibix.com/term/development/vite)
- [JavaScript](https://learn.benibix.com/term/development/javascript)
- [npm](https://learn.benibix.com/term/development/npm)

## Told apart from

- [Vite vs webpack](https://learn.benibix.com/compare/vite-vs-webpack): People think Vite and webpack do different jobs, and they do the same one. Both are bundlers that pack your files for the browser. webpack bundles even while you work. Vite skips that step until the final build, so it starts much faster.

---

Source: https://learn.benibix.com/term/development/webpack
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
