Webpack Module Bundler

Webpack is a static module bundler for modern JavaScript applications. At its core, webpack processes your application and internally builds a dependency graph from one or more entry points, then combines every module your project needs into one or more bundles, which are static assets to serve your content from.

Since version 4.0.0, webpack does not require a configuration file to bundle your project, but it is incredibly configurable to better fit your needs.

Main Version Comparison

Webpack v5 (Modern Version)

  • Architecture: Modern ES Module support, persistent caching, module federation
  • Features: Built-in code splitting, tree shaking, asset modules, improved performance
  • Configuration: Supports both CommonJS and ES Modules syntax
  • Status: Actively developed

Webpack v4 (Legacy Version)

  • Architecture: Traditional CommonJS-based configuration
  • Features: Basic bundling, code splitting, tree shaking
  • Configuration: CommonJS syntax only
  • Status: Maintained (Long-term support)

Note: Webpack's core concepts remain consistent across versions, but v5 introduces significant performance improvements and new features like Module Federation for micro-frontends.

Core Concepts

Webpack's functionality is built around several core concepts:

  • Entry: Indicates which module webpack should use to begin building the dependency graph
  • Output: Tells webpack where to emit the bundles and how to name them
  • Loaders: Allow webpack to process non-JavaScript files and convert them into valid modules
  • Plugins: Perform wider range of tasks like bundle optimization, asset management, and environment variable injection
  • Mode: Enables built-in optimizations for development or production environments

Webpack supports all browsers that are ES5-compliant (IE8 and below are not supported). Webpack 5 requires Node.js version 10.13.0 or later.