Skip to content
BENIBIX Learn

webpack

Development🌐 Web DevelopmentBuild Tools

Also known as Webpack, webpack.js

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

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.

Example

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

Why it matters

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

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 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.

Common mistake

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

Key takeaways

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

Compare