Skip to main content
Webpack has a rich plugin system that allows you to extend its functionality. Plugins can modify compilation results, add optimization strategies, inject variables, and much more.

Plugin Categories

Built-in Plugins

Webpack includes several powerful built-in plugins:

Optimization Plugins

Plugins that optimize your bundle:

External Plugins

Popular community plugins:

Using Plugins

Plugins are added to your webpack configuration:
const webpack = require('webpack');

module.exports = {
  plugins: [
    new webpack.ProgressPlugin(),
    new webpack.HotModuleReplacementPlugin()
  ]
};

Creating Custom Plugins

Webpack plugins are JavaScript objects with an apply method that is called by the webpack compiler:
class MyPlugin {
  apply(compiler) {
    compiler.hooks.done.tap('MyPlugin', (stats) => {
      console.log('Build complete!');
    });
  }
}
For more information on creating custom plugins, see Define a Plugin.