# webpack — card for AI agents

Module bundler that packages JavaScript, assets and dependencies for browser deployment.

Category: Build tools and bundlers · npm package `webpack` · latest version 5.112.2 (checked 2026-11-01)
Install: `npm install webpack`
License: MIT (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (paste into AGENTS.md or CLAUDE.md)

## webpack
- Install `webpack` and `webpack-cli` as dev dependencies. webpack-cli 7 requires Node.js 20.9.0 or later.
- Put loader rules under `module.rules`, never a top-level `rules`. Write `test` as an unquoted regex like `/\.js$/`, not a string.
- With no config file, the entry is `./src/index.js`. If that file is missing, webpack throws `Can't resolve './src'`. Add `webpack.config.js` with an `entry` to use another file.
- If `package.json` has no `"type": "module"`, write the config with `require(...)` and `module.exports` instead of `import` and `export default`.
- Create plugins with `new` inside the `plugins` array, for example `new webpack.ProgressPlugin()`.
- When the HTML entry loads a ``, set `output.module: true` so webpack emits ES modules.
- Set `mode` explicitly. It defaults to `production`; use `development` for unminified output with source mapping.

## What it is
- Webpack is a module bundler for JavaScript. The README says its main purpose is to bundle JavaScript files for a browser, and that it can also transform, bundle or package "just about any resource or asset". The GitHub repository was created on 2012-03-10 and is MIT licensed.
- It works from entry points. Webpack builds a dependency graph from them and combines every module the project needs into one or more static bundles. Loaders convert other file types into modules. Plugins handle wider jobs such as bundle optimization and asset management. The website's quick start now points webpack at an `index.html` page instead of a script.
- The getting-started guide says webpack is a good fit when an application needs a customizable build pipeline with shared dependencies, npm packages, assets and production builds. The same guide says a bundler may be unnecessary at first for a very small page.

## Caveats
- Native HTML and CSS are experimental: The README calls the built-in HTML and CSS support experimental. It says CSS preprocessors and template engines still need their loaders.
- Latest patch notes lean on HTML and CSS fixes: In the visible part of the notes for v5.111.1 (2026-09-18), many entries are fixes to HTML parsing and to the HTML and CSS minifiers.
- Easy config mistakes: The docs warn that rules belong under `module.rules`, not a top-level `rules`. They also warn that a regex in `test` must not be quoted, because a quoted value matches a single file path.
- The guide's webpack-cli 7 needs Node.js 20.9.0: The getting-started guide warns that its examples use webpack-cli 7, which requires Node.js 20.9.0 or later.
- Older browsers need a Promise polyfill: Webpack supports ES5-compliant browsers, not IE8 or below. Dynamic `import()` and `require.ensure()` need `Promise`, so older browsers need a polyfill.

## Numbers (AgentGid data)
- Gid Score: 82.7 (#61 of all tools, 6 of 185 in its category)
- Used in 53 public projects set up for AI coding agents (0.8%)
- Downloads last week: 76,909,237 (as of 2026-11-24), +38.2% over 4 weeks
- GitHub stars: 66,018 (as of 2026-11-24)
- Last push: 2026-11-23

## Often used with
webpack CLI 62.3%, ESLint 77.4%, Babel (JavaScript) 35.8%, ts-loader 35.8%, Sass 30.2%, Jest 26.4%

## Checked alternatives (same job)
- Vite: https://agentgid.com/tools/vite/agent.md
- esbuild: https://agentgid.com/tools/esbuild/agent.md
- SWC: https://agentgid.com/tools/swc-core/agent.md
- tsup: https://agentgid.com/tools/tsup/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/webpack/
- Homepage: https://github.com/webpack/webpack
- Repository: https://github.com/webpack/webpack
- Source: https://github.com/webpack/webpack#readme
- Source: https://github.com/webpack/webpack
- Source: https://github.com/webpack/webpack/releases
- Source: https://webpack.js.org
- Source: https://webpack.js.org/guides/getting-started
- Source: https://webpack.js.org/concepts/

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
