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.

♦ in production mode (opposite in development mode)

X is the length of the path string

Module System Support

ToolAdditional chunks on demandAMD defineAMD requireAMD require on demandCommonJS exportsCommonJS requireCommonJS require.resolveES2015 import/export
webpack/webpackyesyesyesyesyesyesyesyes (webpack 2)
jrburke/requirejsyesyesyesmanual configdefine wrap onlydefine wrap onlynono
substack/node-browserifynodeamdifynonoyesyesnono
jspm/jspm-cliSystem.importyesyesyesyesyesnoyes
rollup/rollupnorollup-plugin-amdnonocommonjs-plugincommonjs-pluginnoyes
brunch/brunchnoyesyesnoyesyes-yes, via es6 module transpiler

Require & Path Handling

ToolConcat in requireExpressions (guided)Expressions (free)Indirect requireMangle pathsNode.js built-insOther Node.js stuffBrowser replacementRequirable files
webpack/webpackyesyes (all files matching included)manual configyesyesyesprocess, __dir/filename, globalweb_modules, .web.js, package.json field, alias config option243B + 20B per module + 4B per dependency
jrburke/requirejsno♦no♦no♦no♦nono-alias optionsweb
substack/node-browserifynonononopartialyesprocess, __dir/filename, globalpackage.json field, alias optionfile system
jspm/jspm-clinonononoyesyesprocess, __dir/filename, global for cjspackage.json, alias optionthrough plugins
rollup/rollupnononononot requirednode-resolve-pluginglobal (commonjs-plugin)nofile system or through plugins
brunch/brunch-no--no---file system

Build & Output

ToolGenerate single bundleMulti pages buildMultiple bundlesLoad each file separateMinimizingPreprocessingPlugins
webpack/webpackyesmanual configyesnoTerserloadersyes
jrburke/requirejsyes♦yesmanual configyesuglify, closure compilerloadersyes
substack/node-browserifyyesmanual configmanual confignouglifyifytransformsyes
jspm/jspm-cliyesbundle arithmeticyesyesyesplugin translateyes
rollup/rollupyesnononouglify-pluginplugin transformsyes
brunch/brunchyesnoyesnoUglifyJS-brunchcompilers, optimizersyes

Developer Experience

ToolDebugging supportWatch modeDependenciesRuntime overhead
webpack/webpackSourceUrl, SourceMapsyes19MB / 127 packagesyes
jrburke/requirejsnot requirednot required11MB / 118 packages14.7kB + 0B per module + (3B + X) per dependency
substack/node-browserifySourceMapswatchify1.2MB / 1 package415B + 25B per module + (6B + 2X) per dependency
jspm/jspm-cliSourceUrl, SourceMapsnot needed in dev26MB / 131 packages5.5kB self-exec bundles, 38kB full loader+polyfill, 0 plain modules, 293B CJS, 139B ES2015 System.register before gzip
rollup/rollupSourceUrl, SourceMapsrollup-watch?MB / 3 packagesnone for ES2015 modules (other formats may have)
brunch/brunchSourceMapsyes--

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