title: Routing not working in a react app with webpack
body: <p>I'm trying to create a <code>react</code> app with <code>webpack</code> which has some routing as well.</p>
  <pre><code> &quot;react-router-dom&quot;: &quot;^5.2.0&quot;,
  </code></pre>
  <p>The routing works but when I go to a specific route and reload the page, it gives an error <em>cannot get /about</em></p>
  <pre><code>import React from &quot;react&quot;;
  import {
    BrowserRouter as Router,
    Switch,
    Route,
    Link
  } from &quot;react-router-dom&quot;;
  
  export default function App() {
    return (
      &lt;Router&gt;
        &lt;div&gt;
          &lt;nav&gt;
            &lt;ul&gt;
              &lt;li&gt;
                &lt;Link to=&quot;/&quot;&gt;Home&lt;/Link&gt;
              &lt;/li&gt;
              &lt;li&gt;
                &lt;Link to=&quot;/about&quot;&gt;About&lt;/Link&gt;
              &lt;/li&gt;
              &lt;li&gt;
                &lt;Link to=&quot;/users&quot;&gt;Users&lt;/Link&gt;
              &lt;/li&gt;
            &lt;/ul&gt;
          &lt;/nav&gt;
          &lt;Switch&gt;
            &lt;Route path=&quot;/about&quot;&gt;
              &lt;About /&gt;
            &lt;/Route&gt;
            &lt;Route path=&quot;/users&quot;&gt;
              &lt;Users /&gt;
            &lt;/Route&gt;
            &lt;Route path=&quot;/&quot;&gt;
              &lt;Home /&gt;
            &lt;/Route&gt;
          &lt;/Switch&gt;
        &lt;/div&gt;
      &lt;/Router&gt;
    );
  }
  
  function Home() {
    return &lt;h2&gt;Home&lt;/h2&gt;;
  }
  
  function About() {
    return &lt;h2&gt;About&lt;/h2&gt;;
  }
  
  function Users() {
    return &lt;h2&gt;Users&lt;/h2&gt;;
  }
  </code></pre>
  <p>As mentioned in <a href="https://stackoverflow.com/questions/44805562/how-to-configure-webpack-dev-server-with-react-router-dom-v4">this</a> answer, adding</p>
  <pre><code>devServer: {
      historyApiFallback: true,
    }
  </code></pre>
  <p>fixes the issue when its being run locally, but as soon as I deploy it, I get the same error</p>