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.

ToolAdditional chunks are loaded on demandAMD defineAMD requireAMD require loads on demandCommonJS exportsCommonJS requireCommonJS require.resolveConcat in require require("./fi" + "le")Debugging supportDependenciesES2015 import/exportExpressions in require (guided) require("./templates/" + template)Expressions in require (free) require(moduleName)Generate single bundleIndirect require var r = require; r("./file")Load each file separateMangle path namesMinimizingMulti pages buildMultiple bundlesNode.js built-in libs require("path")Other Node.js stuffPluginsPreprocessingReplacement for browserRequirable filesRuntime overheadWatch mode
webpack/webpackyesyesyesyesyesyesyesyesSourceUrl, SourceMaps19MB / 127 packagesyes (webpack 2)yes (all files matching included)with manual configurationyesyesnoyesTerserwith manual configurationyesyesprocess, __dir/filename, globalyesloadersweb_modules, .web.js, package.json field, alias configuration option243B + 20B per module + 4B per dependencyyesyes
jrburke/requirejsyesyesyeswith manual configurationonly wrapping in defineonly wrapping in definenono♦not required11MB / 118 packagesnono♦no♦yes♦no♦yesnouglify, closure compileryeswith manual configurationno-yesloadersalias optionsweb14.7kB + 0B per module + (3B + X) per dependencynot required
substack/node-browserifynodeamdifynonoyesyesnonoSourceMaps1.2MB / 1 packagenononoyesnonopartialuglifyifywith manual configurationwith manual configurationyesprocess, __dir/filename, globalyestransformspackage.json field, alias optionfile system415B + 25B per module + (6B + 2X) per dependencywatchify
jspm/jspm-cliSystem.importyesyesyesyesyesnonoSourceUrl, SourceMaps26MB / 131 packagesyesnonoyesnoyesyesyeswith bundle arithmeticyesyesprocess, __dir/filename, global for cjsyesplugin translatepackage.json, alias optionthrough plugins5.5kB for self-executing bundles, 38kB for full loader and polyfill, 0 plain modules, 293B CJS, 139B ES2015 System.register before gzipnot needed in dev
rollup/rollupnorollup-plugin-amdnonocommonjs-plugincommonjs-pluginnonoSourceUrl, SourceMaps?MB / 3 packagesyesnonoyesnononot required (path names are not included in the bundle)uglify-pluginnononode-resolve-pluginglobal (commonjs-plugin)yesplugin transformsnofile system or through pluginsnone for ES2015 modules (other formats may have)rollup-watch
brunch/brunchnoyesyesnoyesyes--SourceMaps-yes, via es6 module transpilerno-yes-nonoUglifyJS-brunchnoyes--yescompilers, optimizers-file system-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.

7 Contributors

pksjcebebrawchrisVillanuevatashiansimon04byzykkaranrajsurya