webpack
Module bundler that packages JavaScript, assets and dependencies for browser deployment.
3. Used by agents' projects
Dependency in 53 public GitHub projects set up for AI coding agents that we scanned (0.8%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error
What webpack does
Webpack is a bundler that dates to 2012, and it can now take an HTML page as its entry and handle the page, its CSS and its scripts itself, through built-in support the README still calls experimental, while keeping the loader and plugin system it was built around.
webpack popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How webpack is used
- webpack is a dependency in 53 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (1.1% of the 4,867 JavaScript/TypeScript ones), #18 of 185 in build tools and bundlers.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 328; those are left out of every share on this page.
- The most used alternative in our scan is Vite (1,238 projects).
- Projects that use it most often also use webpack CLI (62.3%), ESLint (77.4%), Babel (JavaScript) (35.8%).
- It is more common in projects set up for Roo Code (4.5%) than for Claude Code (0.9%).
By coding agent
Often used with
webpack in practice
Strengths
The website's quick start sets <code>entry</code> to <code>./src/index.html</code>. The site says webpack then bundles what the page references and rewrites the URLs, and adds: "No loader, no plugin."
The site says <code>--mode production</code> minifies the page, stylesheet and script and drops unused code. It says <code>--mode development</code> leaves output unminified and maps the bundle back to your source in devtools.
The README lists TypeScript to JavaScript, Handlebars strings to compiled functions and images to Base64 as examples. It also lists loaders for Sass, Less, PostCSS, Vue and Svelte.
Output can be a single bundle or several chunks loaded on demand at runtime. The README gives reducing initial loading time as the reason.
Watch out for
The README calls the built-in HTML and CSS support experimental. It says CSS preprocessors and template engines still need their loaders.
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.
The docs warn that rules belong under <code>module.rules</code>, not a top-level <code>rules</code>. They also warn that a regex in <code>test</code> must not be quoted, because a quoted value matches a single file path.
Use an HTML page as the entry
export default {
entry : "./src/index.html" ,
output : {
// the page loads a `<script type="module">`, so emit ES modules to match
module : true ,
} ,
} ;More about webpack
Funding
- Open Collective: https://opencollective.com/webpack
Head to head
- esbuild vs webpack used together in 5 projects
- Vite vs webpack used together in 13 projects
Packages around it
- webpack-cli: Command-line runner
- webpack-dev-server: Development server
- phaser: HTML5 game framework
- html-webpack-plugin: HTML page generation
- babel-loader: Babel transpiling loader
- @babel: JavaScript compiler
More in Build tools and bundlers
Alternatives
webpack This page
Fast native-ESM powered web development build tool and dev server.
Extremely fast JavaScript and CSS bundler and minifier written in Go.
Super-fast Rust-based JavaScript compiler and bundler alternative to Babel.
Zero-config TypeScript library bundler powered by esbuild.
Get started
Install it.
npm install webpackRules for your agent
## 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 `<script type="module">`, set `output.module: true` so webpack emits ES modules.
- Set `mode` explicitly. It defaults to `production`; use `development` for unminified output with source mapping.