W3cubDocs

/webpack

HotModuleReplacementPlugin

Enables Hot Module Replacement, otherwise known as HMR.

HMR should never be used in production.

Basic Usage

Enabling HMR is easy and in most cases no options are necessary.

new webpack.HotModuleReplacementPlugin({
  // Options...
});

Options

The following options are accepted:

  • multiStep (boolean): If true, the plugin will build in two steps -- first compiling the hot update chunks, and then the remaining normal assets.
  • fullBuildTimeout (number): The delay between the two steps when multiStep is enabled.
  • requestTimeout (number): The timeout used for manifest download (since webpack 3.0.0)
These options are experimental and may be deprecated. As mentioned above, they are typically not necessary and including a new webpack.HotModuleReplacementPlugin() is enough.

Further Reading

© JS Foundation and other contributors
Licensed under the Creative Commons Attribution License 4.0.
https://webpack.js.org/plugins/hot-module-replacement-plugin