title: can I use webpack middlewares in vanilla node.js server?
body: <p>I used <code>webpack-dev-middleware</code> and <code>webpack-hot-middleware</code> before to run an express server in development. This approach can run a development environment without using <code>webpack dev server</code>. Webpack handles the bundling and express handles the server logic and static files.</p>
  
  <p>Now I want to use vanilla node.js server because express setup is not fast enough for my app. And I want to use webpack with my new setup. But I wonder if I can use the previous two middlewares in my new setup? If I can that would be perfect. But if I can't what is the best approach for me? I have read something like starting two servers during development. One for webpack-dev-server and the other running node.js server. I think this approach is complicated and make me confused in development. Is there any better way? I personally prefer something like two configurations in my <code>server.js</code>, for example:</p>
  
  <pre><code>const isDeveloping = process.env.NODE_ENV !== 'production';
  const port = isDeveloping ? 8080 : process.env.PORT;
  server.listen(port, function() {
    console.info('server listening on port ' + port);
  });
  </code></pre>
  
  <p>But I don't know how to move on, as I am more familiar with using the middlewares than fiddling with the configuration.</p>