title: Do I remove webpack-dev-server and hot-module middleware code during production build, or when I get ready for production?
body: <p>As the title suggests, when I'm ready to host the code for production, should I remove all usages of <code>webpack-dev-middleware</code> and <code>webpack-hot-middleware</code> from my server code as they are <code>dev-dependencies</code>? What's the best way to set this up so maybe I don't have to worry about this?</p>
  
  <p>This is a snapshot of my server code:</p>
  
  <pre><code>// webpack -&gt; HMR
  const webpack = require("webpack");
  const webpackConfig = require("../webpack.config");
  const compiler = webpack(webpackConfig);
  
  // webpack HMR init
  app.use(
      require("webpack-dev-middleware")(compiler, {
          noInfo: false,
          publicPath: webpackConfig.output.publicPath,
      })
  );
  app.use(require("webpack-hot-middleware")(compiler));
  
  ...
  
  app.get("/", async (req, res) =&gt; {
      const initialContent = await serverRender();
      res.render("index", {
          ...initialContent,
      });
  });
  
  app.listen(port, () =&gt; {
      console.log(`Express application listening on port ${port}`);
  });
  </code></pre>