webpack /webpack
A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through "loaders", modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.
★ 65,997⑂ 9,594👁 1,414⑃ 10,644● 10,299▤ 471◈ 1,589
65,997
stars
+1+19+-21
9,594
forks
1,414
watchers
10,644
prs
10,299
issues
471
releases
1,589
discussions
README
[![npm][npm]][npm-url]
[![node][node]][node-url]
[![builds1][builds1]][builds1-url]
[![dependency-review][dependency-review]][dependency-review-url]
[![coverage][cover]][cover-url]
[![PR's welcome][prs]][prs-url]
webpack
Webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset.
Table of Contents
- Install
- Introduction
- Concepts
- Contributing
- Support
- Current project members
- TSC (Technical Steering Committee)
- Core Collaborators
- Sponsoring
- Premium Partners
- Gold Sponsors
- Silver Sponsors
- Bronze Sponsors
- Backers
- Special Thanks
Install
Install with npm:
bash
npm install --save-dev webpack
Install with yarn:
bash
yarn add webpack --dev
Introduction
Webpack is a bundler for modules. The main purpose is to bundle JavaScript
files for usage in a browser, yet it is also capable of transforming, bundling,
or packaging just about any resource or asset.
TL;DR
- Bundles ES Modules, CommonJS, and AMD modules (even combined).
- Can create a single bundle or multiple chunks that are asynchronously loaded at runtime (to reduce initial loading time).
- Dependencies are resolved during compilation, reducing the runtime size.
- Loaders can preprocess files while compiling, e.g. TypeScript to JavaScript, Handlebars strings to compiled functions, images to Base64, etc.
- Highly modular plugin system to do whatever else your application requires.
Learn about webpack through videos!
- Understanding Webpack - Video 1
- Understanding Webpack - Video 2
Get Started
Check out webpack's quick Get Started guide and the other guides.
Browser Compatibility
Webpack supports all browsers that are ES5-compliant (IE8 and below are not supported).
Webpack also needs Promise for import() and require.ensure(). If you want to support older browsers, you will need to load a polyfill before using these expressions.
Concepts
Plugins
Webpack has a rich plugin
interface. Most of the features
within webpack itself use this plugin interface. This makes webpack very
flexible.
Webpack generates HTML pages and extracts CSS files itself — stable and on by
default since 5.109.0, replacing the deprecated html-webpack-plugin and
mini-css-extract-plugin. Point an entry at an .html file, or set
output.html: true to generate a page for a JavaScript entry (if a rule of your
own already handles .html files, also set experiments.html: true; that
also resolves an ESM import without an extension, such as ./page, to page.html
before page.js). See what that covers for
CSS and
HTML.
| Name | Status | Install Size | Description |
| :---------------------------------------: | :----------------: | :-----------------: | :-----------------------------------Top issues
#20537unused default export not marked as unused, so isn't tree-shaken away55 comments · 2026-02-25#11033Federated Modules: Dynamic Remotes49 comments · 2020-06-13#985Unexpected behavior with linked NPM modules40 comments · 2015-04-16#3957Imported variable bindings have difficult to debug names.39 comments · 2017-01-14#16173Using Webpack Module Federation breaks Workers32 comments · 2022-08-22#5866Webpack without bundling for server-side compilation32 comments · 2017-10-21#15554Module Federation: unable to share externalized dependency between host and remote30 comments · 2022-03-18#17288Apply same ESM/CJS interop in `.mts`/`.ts` files as in `.mjs`/`.js` files28 comments · 2023-05-30
Discussions
#23154Clarification requested: automatic closure of PRs #23118 and #231190 comments · 2026-11-06#22922How to use Google font when using Webpack native HTML and CSS bundling3 comments · 2026-10-26#22895Webpack-dev-server 6.1.0 causes 'Can't import the named export 'Logger'"0 comments · 2026-10-24#22808How to output JS file as is + how to output assets to subdirectories (including links in HTML file)3 comments · 2026-10-19#22311yarn test:integration Taking Around 2 Hours — Is This Expected?1 comments · 2026-09-25#21883Webpack 5.110.2 causes `@mui/utils/chainPropTypes` to be reported as having no default export1 comments · 2026-08-31#21835How should filesystem cache track an optional build dependency that may not exist?2 comments · 2026-08-26#21080`enhanced-resolve`: What is the expected fallback behavior when `restrictions` is combined with multiple `modules` entries?1 comments · 2026-06-03
Latest release
v5.112.2 v5.112.2 2026-10-23Patch Changes - Reduce repeated scans when concatenating imported modules. (by @xiaoxiaojx in 22865) - Avoid allocating CSS module sets for single-group chunks. (by @xiaoxiaojx in 22866) - Return the value of every module type loaded with importModule(). (by @alexander-akait in 22869)