Three ways to set up your webpack hot module replacement: webpack-dev-server CLI, webpack-dev-server API, and express with webpack-hot-middleware.
JavaScript HTML
Latest commit 48f0d9c Nov 6, 2015 @ahfarmer Initial commit 😺

README.md

HMR 3 Ways

There are 3 ways to use Webpack HMR. This repository contains a minimal example of each way. In order from simplest to most complex:

Here is a short discussion on how to pick the method you want to use.

About the Code

The actual javascript code within each directory is the same. There are 3 files:

js/index.js: Entry point. require()s the other 2 files, box-creator.js and math-doer.js.

js/math-doer.js: An extremely simple file to illustrate that dependencies are automatically updated by HMR.

js/box-creator.js: An example of a dependency that has side effects, with an example of how to use module.hot.dispose to handle such side effects.