SkillAgentSearch skills...

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.

Install / Use

/learn @webpack/Webpack

README

<div align="center"> <a href="https://github.com/webpack/webpack"> <img width="200" height="200" src="https://webpack.js.org/assets/icon-square-big.svg"> </a> <br> <br>

[![npm][npm]][npm-url]

[![node][node]][node-url] [![builds1][builds1]][builds1-url] [![dependency-review][dependency-review]][dependency-review-url] [![coverage][cover]][cover-url] pkg.pr.new [![PR's welcome][prs]][prs-url] compatibility-score downloads install-size backers sponsors contributors discussions discord LFX Health Score

<h1>webpack</h1> <p> 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. </p> </div>

Table of Contents

Install

Install with npm:

npm install --save-dev webpack

Install with yarn:

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!

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.

| Name | Status | Install Size | Description | | :---------------------------------------: | :----------------: | :-----------------: | :-------------------------------------------------------------------------------------- | | mini-css-extract-plugin | mini-css-npm | mini-css-size | Extracts CSS into separate files. It creates a CSS file per JS file which contains CSS. | | compression-webpack-plugin | compression-npm | compression-size | Prepares compressed versions of assets to serve them with Content-Encoding | | html-bundler-webpack-plugin | bundler-npm | bundler-size | Renders a template (EJS, Handlebars, Pug) with referenced source asset files into HTML. | | html-webpack-plugin | html-plugin-npm | html-plugin-size | Simplifies creation of HTML files (index.html) to serve your bundles | | pug-plugin | pug-plugin-npm | pug-plugin-size | Renders Pug files to HTML, extracts JS and CSS from sources specified directly in Pug. |

Loaders

Webpack enables the use of loaders to preprocess files. This allows you to bundle any static resource way beyond JavaScript. You can easily write your own loaders using Node.js.

Loaders are activated by using loadername! prefixes in require() statements, or are automatically applied via regex from your webpack configuration.

JSON

| Name | Status | Install Size | Description | | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------: | :----------: | :------------------------------: | | <a href="https://github.com/awnist/cson-loader"><img width="48" height="48" src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/coffeescript/coffeescript-original.svg"></a> | cson-npm | cson-size | Loads and transpiles a CSON file |

Transpiling

| Name | Status | Install Size | Description | | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------: | :------------: | :------------------------------------------------------------------------------------------------ | | <a href="https://github.com/babel/babel-loader"><img width="48" height="48" title="babel-loader" src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/babel/babel-original.svg"></a> | ![babel-npm] | ![babel-size] | Loads ES2015+ code and transpiles to ES5 using <a href="https://github.com/babel/babel">Babel</a> | | <a href="https://github.com/TypeStrong/ts-loader"><img width="48" height="48" src="https://raw.githubusercontent.com/microsoft/TypeScript-Website/f407e1ae19e5e990d9901ac8064a32a8cc60edf0/packages/typescriptlang-org/static/branding/ts-logo-128.svg"></a> | ![type-npm] | ![type-size] | Loads TypeScript l

Related Skills

View on GitHub
GitHub Stars66.0k
CategoryDevelopment
Updated2h ago
Forks9.3k

Languages

JavaScript

Security Score

100/100

Audited on Mar 20, 2026

No findings