title: React server-side rendering with hot module reload
body: <p>I've been doing a lot of reading on this, it seems that a lot of boilerplates available on github that enable both of these use webpack-dev-server to rebuild the client bundle. However, I'm not sure how or if the server is hot-module reloaded. Is there a way to configure webpack to enable HMR on the server-side? Otherwise, it seems that anything I change won't be rendered by the server, only refreshed on the client.</p>
  
  <p>My webpack config looks something like this:</p>
  
  <pre><code>module.exports = {
    entry: "./js/client.js",
    module: {
      loaders: [
        {
          test: /\.jsx?$/,
          exclude: /(node_modules|bower_components)/,
          loader: 'babel-loader',
          query: {
            presets: ['react', 'es2015', 'stage-0'],
            plugins: ['react-html-attrs', 'transform-class-properties', 'transform-decorators-legacy'],
          }
        }
      ]
    },
    output: {
      path: __dirname + "/public/",
      filename: "client.min.js"
    }
  };
  </code></pre>
  
  <p>server.js:</p>
  
  <pre><code>app.get('/', function(request, response) {
    var html = ReactDOMServer.renderToString(React.createElement(Component));
    response.send(html);
  });
  </code></pre>
  
  <p>Component.js:</p>
  
  <pre><code>module.exports = React.createClass({
    _handleClick: function() {
      alert();
    },
  
    render: function() {
      return (
        &lt;html&gt;
          &lt;head&gt;
            &lt;title&gt;{this.props.title}&lt;/title&gt;
            &lt;link rel="stylesheet" href="/style.css" /&gt;
          &lt;/head&gt;
          &lt;body&gt;
            &lt;h1&gt;{this.props.title}&lt;/h1&gt;
            &lt;p&gt;isn't server-side rendering remarkable?&lt;/p&gt;
            &lt;button onClick={this._handleClick}&gt;Click me&lt;/button&gt;
            &lt;script dangerouslySetInnerHTML={{
              __html: 'window.PROPS=' + JSON.stringify(this.props)
            }} /&gt;
            &lt;script src="/client.min.js" /&gt;
          &lt;/body&gt;
        &lt;/html&gt;
      );
    }
  })
  </code></pre>
  
  <p>and client.js:</p>
  
  <pre><code>var props = window.PROPS;
  
  ReactDOM.render(React.createElement(Component, props), document);
  </code></pre>
  
  <p>I use <code>webpack-dev-server --content-base src --inline --hot</code> to run webpack</p>