Find file History
Type Name Latest commit message Commit time
Failed to load latest commit information.
js update to webpack 2 Feb 8, 2017
www Initial commit 😺 Nov 6, 2015 Initial commit 😺 Nov 6, 2015
package.json ⬆️ update to webpack 3 Jan 12, 2018
server.js update to webpack 2 Feb 8, 2017
webpack.config.js update to webpack 2 Feb 8, 2017

HMR w/ webpack-dev-server API

This project shows an example of how to use Webpack HMR with the webpack-dev-server API.


npm install


npm start

Open http://localhost:8080.


The npm start command runs: node server.js. This starts the webpack-dev-server with it's API. This is a very flexible way to use the dev server because you can run it from within your gulp or grunt tasks, or from within your own custom scripts.

If you compare the API webpack.config.js located here and the CLI webpack.config.js, you'll notice that the API version has a few additions:

  • HotModuleReplacementPlugin in the plugins: section.
  • webpack/hot/dev-server entry point.
  • webpack-dev-server/client... entry point.

When you run the webpack dev server with the CLI you don't need these, because the webpack-dev-server CLI adds them for you. So running the webpack-dev-server via it's API is slightly more complicated - but worth it if it fits your workflow.