Printable
webpack
Install Webpack
npm install --save-dev webpack webpack-cliWrite Your Code
src/index.js
import bar from "./bar.js";
bar();src/bar.js
export default function bar() {
//
}Bundle It
Start without a configuration file, or provide a custom webpack.config.js:
import path from "node:path";
import { fileURLToPath } from "node:url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default {
entry: "./src/index.js",
output: {
path: path.resolve(__dirname, "dist"),
filename: "bundle.js",
},
};Prefer a video walkthrough? Without config
page.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
...
</head>
<body>
...
<script src="dist/bundle.js"></script>
</body>
</html>Then run webpack on the command-line to create bundle.js.
Awesome, isn't it? Let's dive in!
Get Started quickly in our Guides section, or dig into the Concepts section for more high-level information on the core notions behind webpack.
Comparison
Webpack is not the only module bundler out there. If you are choosing between using webpack or any of the bundlers below, here is a feature-by-feature comparison on how webpack fares against the current competition.
| Feature | webpack/webpack | jrburke/requirejs | substack/node-browserify | jspm/jspm-cli | rollup/rollup | brunch/brunch |
|---|---|---|---|---|---|---|
| Additional chunks are loaded on demand | yes | yes | no | System.import | no | no |
AMD define | yes | yes | deamdify | yes | rollup-plugin-amd | yes |
AMD require | yes | yes | no | yes | no | yes |
AMD require loads on demand | yes | with manual configuration | no | yes | no | no |
CommonJS exports | yes | only wrapping in define | yes | yes | commonjs-plugin | yes |
CommonJS require | yes | only wrapping in define | yes | yes | commonjs-plugin | yes |
CommonJS require.resolve | yes | no | no | no | no | - |
Concat in require require("./fi" + "le") | yes | no♦ | no | no | no | - |
| Debugging support | SourceUrl, SourceMaps | not required | SourceMaps | SourceUrl, SourceMaps | SourceUrl, SourceMaps | SourceMaps |
| Dependencies | 19MB / 127 packages | 11MB / 118 packages | 1.2MB / 1 package | 26MB / 131 packages | ?MB / 3 packages | - |
ES2015 import/export | yes (webpack 2) | no | no | yes | yes | yes, via es6 module transpiler |
Expressions in require (guided) require("./templates/" + template) | yes (all files matching included) | no♦ | no | no | no | no |
Expressions in require (free) require(moduleName) | with manual configuration | no♦ | no | no | no | - |
| Generate a single bundle | yes | yes♦ | yes | yes | yes | yes |
Indirect require var r = require; r("./file") | yes | no♦ | no | no | no | - |
| Load each file separate | no | yes | no | yes | no | no |
| Mangle path names | yes | no | partial | yes | not required (path names are not included in the bundle) | no |
| Minimizing | Terser | uglify, closure compiler | uglifyify | yes | uglify-plugin | UglifyJS-brunch |
| Multi pages build with common bundle | with manual configuration | yes | with manual configuration | with bundle arithmetic | no | no |
| Multiple bundles | yes | with manual configuration | with manual configuration | yes | no | yes |
Node.js built-in libs require("path") | yes | no | yes | yes | node-resolve-plugin | - |
| Other Node.js stuff | process, __dir/filename, global | - | process, __dir/filename, global | process, __dir/filename, global for cjs | global (commonjs-plugin) | - |
| Plugins | yes | yes | yes | yes | yes | yes |
| Preprocessing | loaders | loaders | transforms | plugin translate | plugin transforms | compilers, optimizers |
| Replacement for browser | web_modules, .web.js, package.json field, alias configuration option | alias option | package.json field, alias option | package.json, alias option | no | - |
| Requirable files | file system | web | file system | through plugins | file system or through plugins | file system |
| Runtime overhead | 243B + 20B per module + 4B per dependency | 14.7kB + 0B per module + (3B + X) per dependency | 415B + 25B per module + (6B + 2X) per dependency | 5.5kB for self-executing bundles, 38kB for full loader and polyfill, 0 plain modules, 293B CJS, 139B ES2015 System.register before gzip | none for ES2015 modules (other formats may have) | - |
| Watch mode | yes | not required | watchify | not needed in dev | rollup-watch | yes |
♦ in production mode (opposite in development mode)
X is the length of the path string
Bundling vs. Loading
It's important to note some key differences between loading and bundling modules. A tool like SystemJS, which can be found under the hood of JSPM, is used to load and transpile modules at runtime in the browser. This differs significantly from webpack, where modules are transpiled (through "loaders") and bundled before hitting the browser.
Each method has its advantages and disadvantages. Loading and transpiling modules at runtime can add a lot of overhead for larger sites and applications comprised of many modules. For this reason, SystemJS makes more sense for smaller projects where fewer modules are required. However, this may change a bit as HTTP/2 will improve the speed at which files can be transferred from server to client. Note that HTTP/2 doesn't change anything about transpiling modules, which will always take longer when done client-side.
Awesome webpack
A curated list of awesome webpack resources, libraries, tools and applications. It is inspired by the awesome list. Feel free to improve this list by contributing.
Webpack Ecosystem
Support Webpack
- Webpack Open Collective - Help support the teams ongoing development efforts.
Community
People passionate about Webpack (In no particular order)
- Sean T. Larkin - @TheLarkInn TPM at Microsoft. Developer Advocate and webpack core team member.
- Juho Vepsäläinen - @bebraw from SurviveJS and webpack core team member.
- Eric Clemmons - @ericclemmons VP of Software Development at HigherEdHQ. Webpack member.
- Patrick Stapleton - @gdi2290 from AngularClass, AngularAir and Angular Universal. Webpack member.
- Kent C. Dodds - @kentcdodds from PayPal Engineering and JavaScript Air. Webpack member.
- Johannes Ewald - @Jhnnns: Webpack core team member.
- Joshua Wiens - @d3viant0ne: Technical Lead for EasyMetrics. Webpack member.
- Jonathan Creamer - @jcreamer898: Microsoft MVP and Telerik Developer Expert.
- Kees Kluskens - @keeskluskens: - Software Engineer at Code Yellow, Webpack core team member.
Libraries
Loaders
File Type
- HTML Loader: HTML loader module for Webpack. -- Maintainer:
Webpack Team - Responsive Loader: Loader for responsive images. -- Maintainer:
Jeremy Stucki - SVG Url Loader: Loader which loads SVG file as utf-8 encoded Url. -- Maintainer:
Hovhannes Babayan - mermaid Loader: mermaid loader module (diagrams) for Webpack. -- Maintainer:
Paul Musso - wasm loader: wasm binary loader module for Webpack. -- Maintainer:
Arthur Buldauskas - Imagemin Loader/Plugin: Image minimizing loader + plugin for webpack. -- Maintainer:
itgalaxy inc. - Bin Exec Loader: Pipe any file through any binary. -- Maintainer:
Rafael Milewski - GraphQL Loader:
.graphqldocument loader. -- Maintainer:Stephen Wan
Component & Template
- Angular2 Template Loader: Inlines html and style's in Angular2 components. -- Maintainer:
Sean Larkin - Handlebars Loader: A handlebars template loader for Webpack. -- Maintainer:
Paul Carduner - Vue Loader: Webpack loader for Vue.js components. -- Maintainer:
Vuejs Team - SVG React Loader - Webpack SVG to React Component Loader. -- Maintainer:
Jerry Hamlet - Underscore Loader - Underscore and Lodash template loader. -- Maintainer:
Emmanuel Antico - ngTemplate Loader - Angular1 Template Loader. -- Maintainer:
Toby Rahilly - ngInlineStylesLoader: Optimizes inlined css of angular components. -- Maintainer:
Severin Friede - Markup-inline Loader Inline SVGs to HTML -- Maintainer:
Zhicheng Wang - Polymer Loader - Loader for Polymer elements. -- Maintainers:
Rob Dodson-
Chad Killingsworth-
Bryan Coulter - Tag Loader - Loader for Riot tag files. -- Maintainer:
Riot Team - Twig Loader - Twig template loader. -- Maintainer:
Zimmo.be Team - Auto ngTemplate Loader: Autodetect Angular 1 templates and load them. -- Maintainer:
Yash Kulshrestha - Pug Loader - Pug template loader (formerly Jade). -- Maintainer:
Pug Team - Simple Nunjucks Loader - Nunjucks template loader. -- Maintainer:
ogonkov - PWA Manifest Loader - PWA manifest loader. -- Maintainer:
autopulated
Styles
- Style Loader: Style loader module for Webpack. -- Maintainer:
Webpack Team - PostCSS Loader: PostCSS loader for Webpack. -- Maintainer:
PostCSS Team - CSS Loader: CSS loader module for Webpack. -- Maintainer:
Webpack Team - SASS Loader: SASS loader for Webpack. -- Maintainer:
Jorik Tangelder - Less Loader: Less loader module for Webpack. -- Maintainer:
Webpack Team - Stylus Loader: A stylus loader for webpack. -- Maintainer:
Kyle Robinson Young - Isomorphic Style Loader: Isomorphic CSS style loader for Webpack. -- Maintainer:
Kriasoft Team - Minify CSS-in-JS Loader: RegExp-based minify CSS-in-JS loader for Webpack, don't need babel. -- Maintainer:
Zack Young - SASS Resources Loader: Globally import SASS resources (variables, mixins, etc.). -- Maintainer:
ShakaCode
Language & Framework
- TS Loader: TypeScript loader for webpack. -- Maintainer:
TypeStrong Team - Coffee Loader: Coffee loader module for Webpack. -- Maintainer:
Webpack Team - Bootstrap Loader: Load Bootstrap styles in your Webpack bundle. -- Maintainer:
ShakaCode Team - PostHTML Loader: PostHTML loader for Webpack. -- Maintainer:
PostHTML Team - ELM Loader: Webpack loader for the Elm programming language. -- Maintainer:
Richard Feldman - Fengari Loader: Run Lua code using Fengari. -- Maintainer:
Daurnimator
Utility
- Babel Loader: Webpack plugin for Babel. -- Maintainer:
Babel Team - Worker Loader: Worker loader module for Webpack. -- Maintainer:
Webpack Team - Resolve URL Loader: Resolves relative paths in url() statements. -- Maintainer:
Ben Holloway - Import Loader: Imports loader module for Webpack. -- Maintainer:
Webpack Team - Combine Loader - Converts a loaders array into a single loader string. -- Maintainer:
James Friend - Icon Font Loader - Converts svgs into font icons in CSS. -- Maintainer:
Forrest R. Zhao - Icons Loader - Generates an iconfont from SVG dependencies. -- Maintainer:
Mike Vercoelen - Modernizr Loader - Get your modernizr build bundled with webpack. -- Maintainer:
Peerigon Devs - ngRouter Loader - AOT capable NgModule lazy loading using angular router -- Maintainer:
Shlomi Assaf - Lingui Loader - Compile message catalogs on the fly for jsLingui, i18n library -- Maintainer:
Tomáš Ehrlich - Shell Loader - Run an arbitrary shell script on source files. -- Maintainer:
Jo Sprague - EXIF Loader - Extract EXIF- & IPTC-data from your JPGs during build-time. -- Maintainer:
Emanuel Kluge - esbuild Loader - Blazing fast alternative to babel-loader, ts-loader, and Terser powered by esbuild. -- Maintainer:
Hiroki Osame
Testing
- Karma Webpack: Use Karma with Webpack. -- Maintainer:
Webpack Team - Istanbul Webpack plugin: Use Istanbul instrumenter for the whole pack. -- Maintainer:
Hagai Cohen
Integration Libraries
- Dotenv Webpack: Compiles environment variables into your bundle via dotenv. -- Maintainer:
Matthew Steele - Terse Webpack - Webpack simplified in a fluent API with presets. -- Maintainer:
Eric Clemmons - SystemJS Webpack - Webpack bundling for SystemJS. -- Maintainer:
Guy Bedford - Gulp Webpack Stream - Run webpack through a stream interface. -- Maintainer:
Kyle Robinson Young - Webpack Blocks - Configure webpack using functional feature blocks. -- Maintainer:
Andy Wermke - Webpacker - Official webpack gem for integration into ruby on rails projects. -- Maintainer:
Rails - WebpackAspnetMiddleware - Development middleware for ASP.NET 5. -- Maintainer:
Frank Wallis - Consul Key/Value Webpack: Compiles environment variables into your bundle via Consul KV-store. -- Maintainer:
Marlon Maxwel
Webpack Plugins
- DefinePlugin: Create global constants which can be configured at compile time. -- Maintainer:
Webpack Team - Compression Plugin: Prepare assets to serve with Content-Encoding. -- Maintainer:
Webpack Team - Offline Plugin: Offline plugin (ServiceWorker, AppCache) for Webpack. -- Maintainer:
Arthur Stolyar - Rewire Plugin: Dependency injection for Webpack bundles. -- Maintainer:
Johannes Ewald - HTML Webpack Plugin: Simplifies creation of HTML files. -- Maintainer:
Jan Nicklas - Copy Webpack Plugin: Copy files and directories in webpack. -- Maintainer:
Len Boyette - Split By Path: Split By Path Webpack Plugin. -- Maintainer:
Bohdan Tkachenko - SW Precache - Generates a service worker to precache bundle. -- Maintainer:
Will Farley - CoreJS Plugin - Core-JS as a webpack plugin. -- Maintainer:
PatrickJS - Bundle Analyzer - Utility that represents bundles as an interactive treemap. -- Maintainer:
Yuriy Grunin - Module Mapping - Maps modules onto different files. -- Maintainer:
Spartez Team - Serverless Webpack - Serverless plugin to bundle your lambdas. -- Maintainer:
Elastic Coders - Prerender SPA - Framework-agnostic static site generation for SPAs. -- Maintainer:
Chris Fritz - Static Site Generator Plugin - Minimal, unopinionated static site generator. -- Maintainer:
Mark Dalgleish - SVG Sprite Plugin - Plugin for SVG sprites and icons. -- Maintainer:
Jeremy Tice(TodayTix) - Imagemin Webpack Plugin - Minify images with Imagemin. -- Maintainer:
Gregory Benner - Prepack Webpack Plugin - A webpack plugin for prepack. -- Maintainer:
Gajus Kuizinas - Modules CDN Webpack Plugin - Dynamically load your modules from a CDN. -- Maintainer:
Thomas Sileghem - Generate package.json Plugin - Limit dependencies in a deployment
package.jsonto only those that are actually being used by your bundle. -- Maintainer:Paul Myburgh - Progressive Web App Manifest - PWA manifest manager and generator. -- Maintainer:
Arthur A. Bergamaschi - FileManager Webpack Plugin - Copy, move, delete files and directories before and after Webpack builds -- Maintainer:
Gregory Nowakowski - Fork TS Checker Webpack Plugin - Webpack plugin that runs typescript type checker on a separate process. -- Maintainer:
TypeStrong Team - Duplicate Package Checker Webpack Plugin - Warns you when multiple versions of the same package exist in your bundle -- Maintainer:
Darren Scerri - Circular Dependency Plugin - Detect modules with circular dependencies when bundling -- Maintainer:
Aaron Ackerman - webpack-inject-plugin - A webpack plugin to dynamically inject code into the bundle. -- Maintainer:
Adam Dierkens - Public Path Manipulation Plugin - control
publicPathof dynamically loaded resources at runtime -- Maintainer:Andrew Goldis - Build Notifier Plugin - Display OS-level notifications for build errors and warnings. -- Maintainer:
Rocco Cataldo - CSS Cleanup Webpack Plugin - A plugin to remove duplicated and unused css rules -- Maintainer:
Dominik Weber - Extension Reloader - Hot reloading while developing browser extensions -- Maintainer:
Rubens P. G. Cavalcante - Htmls Webpack Plugin: Simple and fast multiple-htmls-generating plugin for webpack. -- Maintainer:
Zack Young - Mini css extract plugin:
Lightweight CSS extraction plugin -- Maintainer:
Webpack Contrib - build-hash-webpack-plugin For each build, Webpack generates an in-memory hash allowing to know if two build outputs are the same or not. This plugin writes the described build hash in a separate json file. -- Maintainer:
Réda Housni Alaoui - webpack-hook-plugin - run any shell commands before or after webpack builds -- Maintainer:
David Kwon - Dynamic Vendor Webpack Plugin - Gives you a way to import vendors with dynamic variable and specific code splitting. -- Maintainer
Lilian Saget-Lethias - Define Variable Webpack Plugin - Enhancement of DefinePlugin to store defined things in actual variables. -- Maintainer
Lilian Saget-Lethias - Shell Script Webpack Plugin - A plugin for running arbitrary shell scripts when compiler hooks are triggered. -- Maintainer
Drew Loomer - Stylelint Webpack Plugin: A Stylelint plugin for webpack. -- Maintainer:
Ricardo Gobbo de Souza - ESLint Webpack Plugin: A ESLint plugin for webpack
. -- Maintainer:
Ricardo Gobbo de Souza - Exclude Assets Webpack Plugin: A plugin to exclude assets from webpack output based on a path RegExp pattern. -- Maintainer:
Klayton Faria - Webpack Shell Plugin Next: A plugin allows you to run any shell commands before or after webpack builds. -- Maintainer:
Kuzmin Pavel - Gettext Webpack Plugin: Embed localization into your bundle using gettext. -- Maintainer:
Juan Luis Paz - Node Polyfill Plugin: Polyfill Node.js core modules. -- Maintainer:
Richie Bendall - Bytenode Plugin: Compile JavaScript into bytecode using bytenode. -- Maintainer:
Herbert Treis Neto - Chrome Extension Archive Webpack Plugin Create archive file to publish Chrome Exentions to Chrome Web Store -- Maintainer:
KeisukeYamashita - Layer-pack Webpack Plugin Allow to glob imports file & directories, build mono repo apps via inheritable source code / npm packages & share webpack configs -- Maintainer:
Braun Nathanaël - webpack-typescript-directory-compile-plugin Configure an source directory of typescript files and an output directory for JavaScript files. Each typescript file in the source directory and any newly added files will be compiled to individual JavaScript files. -- Maintainer:
Stephen Sigwart - CycloneDX Webpack Plugin: Create CycloneDX Software Bill of Materials (SBOM) from webpack bundles at compile time. -- Maintainer:
OWASP CycloneDX Team - Transpile Webpack Plugin: Transpiles input files into output files individually without bundling together. -- Maintainer:
Chungen Li - Manifest Extraction Plugin: Generates an asset manifest after compiling webpack. -- Maintainer:
Andrew Powell - Transform Async Modules Plugin: A Webpack plugin to transpile async module output using Babel. Allows transpiling top level await to ES5. -- Maintainer:
Steve Repsher - CSS Layering Plugin: Wrap CSS in cascade layers. -- Maintainer:
Kresimir Buric
Webpack Tools
- Webpack Dev Middleware: Middleware which arguments a live bundle. -- Maintainer:
Webpack Team - Webpack Dev Server: Serves a webpack app. Updates the browser on changes. -- Maintainer:
Webpack Team - Webpack Merge - Merge designed for Webpack. -- Maintainer:
Juho Vepsäläinen - NPM Install Webpack - Automatically install & save deps with Webpack. -- Maintainer:
Eric Clemmons - Webpack Validator - Validates your webpack config with Joi. -- Maintainer:
js-dxtools Team - Webpack Config Utils - Util. to make your webpack config easier to read. -- Maintainer:
Kent C. Dodds - Angular2 Webpack Toolkit - Webpack tools and helpers for Angular 2. -- Maintainer:
AngularClass - Webpack Bundle Analyzer - Represents bundles as an interactive treemap. -- Maintainer:
Yuriy Grunin - HJS Webpack: Helpers/presets for setting up webpack with hotloading. -- Maintainer:
Henrik Joreteg - Webpack Dashboard: A CLI dashboard for webpack dev server. -- Maintainer:
Formidable Labs - Neutrino: Combines the power of Webpack with the simplicity of presets. -- Maintainer:
Eli Perelman - Speed Measure Plugin - Measures the speed of your webpack plugins and loaders. -- Maintainer:
Stephen Cook - Time Analytics Plugin - Analytics the time cost of loaders and plugins in webpack. Successor of Speed Measure Plugin -- Maintainer:
Song Gao - packtracker.io - Webpack bundle analysis on every commit, report webpack stats to every pull request.
- BundleStats: Analyze webpack stats(bundle size, assets, modules, packages) and compare the results between different builds. -- Maintainer:
Vio - Webpack Landing Generator: Easy way to create landing page that converts. -- Maintainer:
Aliaksei Kuncevic - Webpack Dev Server Firewall: Prevents access to dev server from unknown IPs. -- Maintainer:
Igor Adamenko - RelativeCI: Run in-depth bundle analyses on every build and monitor webpack bundle size, assets, modules, and packages.
Research & Training
Articles
- Aniketh Saha | 16-Oct-19 - Creating a Custom webpack Plugin
- Antoine Caron | 18-Jan-19 - Webpack : an unexpected journey
- Mark Erikson | 07-Mar-17 - Declaratively Rendering Earth in 3D, Building a Cesium + React App with Webpack
- Joseph Zimmerman | 2-Feb-17 - A Detailed Introduction To Webpack.
- Jamund Ferguson | 22-Jul-16 - Manually Tuning Webpack Builds.
- Sean T. Larkin | 21-Jul-16 - Learn and Debug webpack with Chrome Dev Tools!.
- Raja Rao DV | 10-Apr-16 - Webpack — The Confusing Parts.
- Andrew Ray | 09-Apr-16 - Webpack: When To Use and Why.
- Jonathan Creamer | 25-Feb-16 - WebPack Code splitting with ES6 and Babel 6.
- Ilya Zayats | 07-Feb-16 - How to split your apps by routes with Webpack.
- Sebastian De Deyne | 04-Feb-16 - Adventure Time With Webpack.
- Jonathan Creamer | 10-Jan-16 - Advanced WebPack Part 2 - Code Splitting.
- Andy Ccs | 02-Jan-16 - Webpack and Docker for Development and Deployment.
- Jonathan Creamer | 08-Jun-16 - Advanced WebPack Part 3 - Creating a custom notifier plugin.
- Nader Dabit | 07-Sept-15 - Beginner’s guide to Webpack.
- Jonathan Creamer | 02-Sept-15 - Advanced WebPack Part 1 - The CommonsChunk Plugin.
- Maxime Fabre | 16-Oct-15 - Webpack your bags.
- Hridayesh Sharma | 18-Aug-20 - Webpack Setup for a JavaScript Library
Videos
- Sean Larkin JS Kongress | Apr-2-2019 - Everything’s a plugin: Understanding webpack from the inside out
- Colt Steele via Youtube| Mar-7-2019 - Learn Webpack Course
- Naomi A. Jacobs via BuzzJS 2.0 2017 | Feb-27-2017 - Webpack: It's Not Magic
- Jack Franklin at HalfStack2016 | 18-Nov-16 | Seamless client side JavaScript w/ Webpack
- Sean Larkin NEJS Conf | 30-Sep-16 | Webpack: Core Concepts
- Front End Center Webpack from First Principles | 22-Aug-16 - Intro to Webpack
- Eric Clemmons chat with Kent C. Dodds | 01-Jul-16 - Webpack HMR.
- Mirko Nasato (5 Part Series) | 07-Jun-16 - Angular2 with Webpack Project Setup.
- Jonathan Creamer at Nodevember | 05-Dec-15 - Advanced WebPack.
- Kyle Robinson Young | 08-Jul-15 - Getting Started with Webpack.
- Tasveer Singh at TorontoJS Tech Talk | 09-Apr-15 - Webpack.
- Jeremy Lund at Mountain West JS | 28-Mar-15 - Gift Wrap Your Code with Webpack.
Courses
- Webpack for Everyone - Free Laracasts series by Jeffrey Way
- Webpack Fundamentals - Brief introduction about Webpack fundamentals by Sean Larkin
- Web Performance with Webpack - Solving common web performance problems using Webpack by Sean Larkin
- Intro to webpack (playlist) - Egghead.io playlist of a few videos by Kent C. Dodds (the first is free).
- Angular and Webpack for modular applications - Egghead.io course by Kent C. Dodds
- Using Webpack for Production JavaScript Applications - Egghead.io course by Kent C. Dodds (advanced)
- Webpack Fundamentals - Joe Eames for Pluralsight (intermediate)
- Webpack Academy - A comprehensive webpack learning resource.
- Webpack from scratch series on YouTube by Paris Nakita Kejser
Books
- SurviveJS - Webpack: Free book guiding from a webpack apprentice to master. Covers dev, prod, and advanced topics.
Webpack Examples
- Webpack Examples: Examples of common Webpack functionality.
Community Examples
Angular
- Angular2 Webpack Starter - A Webpack driven Angular 2 Starter kit from AngularClass.
- Angular2 Webpack - A complete, yet simple, starter for Angular 2 using Webpack from Preboot.
- Angular2 Webpack Visual Studio - ASP.NET Core, Angular2 with Webpack and Visual Studio from Damien Bod.
- Angular2 Starter - Angular2 starter kit with Typescript and Webpack from Brian Schemp.
- Angular2 Seed - A simple starter demonstrating the basic concepts of Angular2 from Pawel Kozlowski.
Framework Agnostic
- ES6 TodoMVC with Webpack - Repo used to teach webpack. (Check branches). from Kent C. Dodds.
React
- Create React App - Create React apps with no build configuration from Dan Abramov.
- React Starter Kit - Isomorphic web app boilerplate from Kriasoft Team.
- React Redux Universal - A starter boilerplate for a universal webapp from Erik Rasmussen.
- Frontend Boilerplate - A boilerplate of things that mostly shouldn't exist from TJ Holowaychuk.
- ReactGo - Your One-Stop solution for a full-stack universal Redux from Ken Ding.
- React Native Calculator - Mobile, desktop and website Apps with the same code from Benoit Vallon.
- React Cordova Boilerplate - TodoMVC example for React with Cordova from Yuval Saraf.
- React Universally - A starter kit giving you the minimum for a production ready universal react application.
- Razzle Material-UI Styled Example - With Styled Components using Express with compression from Erik Engi.
- Read - A highly scalable react boilerplate from logustra
- @route-resource-preload/webpack-plugin - Focus on improving the first screen loading speed of applications and providing the best user experience, inspiration comes from the preloading of NextJS from Devin Deng.
Vue
Other
- Juho, Johannes, Tobias & Sean on JavaScript Air - JavaScript Air podcast
- Webpack interview questions - Interview questions with answers.
- Visual config tool for webpack - A visual tool for creating webpack configs in your browser
Branding Guidelines
Here you can find webpack project brand guidelines, assets, and license. See our official media repository for more information and to find the license that governs this work. Click any of the images to download them.
The Name
Webpack can be written with a capital W when used at the start of a sentence, otherwise it should be written in lower-case letters.
Logo
The webpack logo should be placed on a white background with enough space around it like this:
Double the size of the inner dark blue cube to get an idea how much space the logo should have.
For dark backgrounds, you can use the negative version of the logo:

Icon only
The icon is designed to be used in layout-constrained areas. As previously stated, please prefer icon + text.
Square-sized icon for bigger areas (like avatars or profile pictures):
Square-sized icon for smaller areas (like favicons):
Color Palette
The following colors are used throughout the site in various combinations and on our fancy clothing line launched with the help of Open Collective and Threadless over at the official webpack store!
| Color Name | HEX Code | RGB Code | Sample |
|---|---|---|---|
| Malibu: | HEX #8dd6f9 | rgb: 141, 214, 249 | |
| Denim: | HEX #1d78c1 | rgb: 29, 120, 193 | |
| Fiord: | HEX #465E69 | rgb: 70, 94, 105 | |
| Outer Space: | HEX #2B3A42 | rgb: 43, 58, 66 | |
| White: | HEX #ffffff | rgb: 255, 255, 255 | |
| Concrete: | HEX #f2f2f2 | rgb: 242, 242, 242 | |
| Alto: | HEX #dedede | rgb: 222, 222, 222 | |
| Dusty Gray: | HEX #999999 | rgb: 153, 153, 153 | |
| Dove Gray: | HEX #666666 | rgb: 102, 102, 102 | |
| Emperor: | HEX #535353 | rgb: 83, 83, 83 | |
| Mine Shaft: | HEX #333333 | rgb: 51, 51, 51 |
In addition, you can grab the following file types directly from these links:
License
The logo and the brand name are not MIT licensed. Please check our LICENSE for usage guidelines.
Glossary
This index lists common terms used throughout the webpack ecosystem.
A
- Asset: This is a general term for the images, fonts, media, and any other kind of files that are typically used in websites and other applications. These typically end up as individual files within the output but can also be inlined via things like the style-loader or url-loader.
B
- Bundle: Produced from a number of distinct modules, bundles contain the final versions of source files that have already undergone the loading and compilation process.
- Bundle Splitting: This process offers one way of optimizing a build, allowing webpack to generate multiple bundles for a single application. As a result, each bundle can be isolated from changes effecting others, reducing the amount of code that needs to be republished and therefore re-downloaded by the client and taking advantage of browser caching.
C
- Chunk: This webpack-specific term is used internally to manage the bundling process. Bundles are composed out of chunks, of which there are several types (e.g. entry and child). Typically, chunks directly correspond with the output bundles however, there are some configurations that don't yield a one-to-one relationship.
- Code Splitting: Refers to dividing your code into various bundles/chunks which you can then load on demand instead of loading a single bundle containing everything.
- Configuration: webpack configuration file is a plain old JavaScript file that exports an object. This object is then processed by webpack based upon its defined properties.
D
- Dependency Graph: Any time one file depends on another, webpack treats this as a dependency. Starting from an entry point(s), webpack recursively builds a dependency graph that includes every module/asset your application needs.
E
- Entry Point: The entry point tells webpack where to start and follows the graph of dependencies to know what to bundle. You can think of your application's entry point(s) as the contextual root(s) of what you want bundled.
H
- Hot Module Replacement (HMR): A process that exchanges, adds, or removes
moduleswhile an application is running without a full page reload.
L
- Loaders: Transformations that are applied on the source code of a module. They allow you to pre-process files as you
require()or "load" them. Similar to a 'task-runner'. - Lazy Loading: A process of loading parts (chunks) of your application lazily. In other words loading them only when we really need them.
M
- Module: Discrete chunks of functionality that provide a smaller surface area than a full program. Well-written modules provide solid abstractions and encapsulation boundaries which make up a coherent design and clear purpose.
- Module Resolution: A module can be required as a dependency from another module and a resolver is a library which helps in locating a module by its absolute path. Modules are searched for inside all directories specified in
resolve.modules. - Manifest: The runtime will use it to resolve and load modules once they've been bundled and shipped to the browser.
O
- Output: Option(s) specifying where to output the compiled files to disk.
Note, that while there can be multiple entry points, only one output configuration is specified.
P
- Plugin: A JavaScript object that has an
applyproperty. Thisapplyproperty is called by the webpack compiler, giving access to the entire compilation lifecycle. These packages will typically extend compilation functionality in one way or another.
R
- Request: Refers to the expression in the require/import statement, e.g. require("./template/" + name + ".ejs"), the request is "./template/" + name + ".ejs".
S
- Shimming: Not all JS files can be used directly with webpack. The file maybe in an unsupported module format, or not even in any module format. It is here where
shimmingcomes into play.
T
- Target: User configured deployment target(s) listed here to compile for a specific environment like the browser, NodeJS, or Electron.
- Tree Shaking: Unused/Excess code elimination, or more precisely, live code importing. Compilers like webpack will accomplish this by analyzing the various kinds
importstatements and usage of the imported code to determine what parts of dependencies are actually being utilized, dropping parts of the "tree" that are not.
V
- Vendor Entry Point: Create dependency graphs starting at both
app.jsandvendors.js. These graphs are completely separate and independent of each other to allow leverage ofCommonsChunkPluginand extract any vendor references from your app bundle into your vendor bundle. Helps achieve a common pattern in webpack known as long-term vendor-caching.
W
License
webpack
Webpack is MIT licensed.
webpack logo and icon
The webpack logo and icon are under a different license which can be found here.
webpack documentation
The content on https://webpack.js.org/ is available under Creative Commons BY 4.0 license meaning attribution is required should you use the content elsewhere.
webpack code samples
The code samples use CC0 1.0 Universal (CC0 1.0) (Public Domain) and you are free to use them as you like.

