title: Basename does not seem to be taken into account with matchPath in react router
body: <p>I am looking into a bug we have with react-router-dom version 5.0.0 and the active class not being applied to the active link.</p>
  
  <p>It works in development when we have a basename of <code>/</code> but in our dev environment, the basename is set to `/some/basename/'.</p>
  
  <p>If I call this <code>matchPath</code> directly like this:</p>
  
  <pre><code>matchPath("/some/basename/business", {
    exact: true,
    location: undefined,
    path: "\/business",
    strict: undefined
  })
  </code></pre>
  
  <p>Then it returns null, if I call matchpath like this, it gets a match:</p>
  
  <pre><code>matchPath("/business", {
    exact: true,
    location: undefined,
    path: "\/business",
    strict: undefined
  })
  </code></pre>
  
  <p>So it looks like <code>matchPath</code> is not using the <code>basename</code> because after trying to debug the code I see that <code>matchPath</code> calls <code>pathToRegexp</code> which creates this regex:</p>
  
  <pre><code>/^\/business\/?$/i
  </code></pre>
  
  <p>The code only appears to be using the <code>path</code> property and not the location.pathname.</p>
  
  <p>I tried to implement my own <code>isActive</code> method to log what was going on:</p>
  
  <pre><code>const isActive = (match: Match&lt;any&gt;, historyLocation: Location) =&gt;  {
    const basename = (window.env.REACT_APP_BASE_URI || "/") === "/" ? "" : window.env.REACT_APP_BASE_URI;
    const fullUrl = `${basename.replace(/^(.+?)\/*?$/, "$1")}${historyLocation.pathname}`;
  
    console.log("----------------------");
    console.log({
      basename,
      fullUrl,
      historyLocation,
      historyLocationPathName: historyLocation.pathname,
      location: window.location.pathname,
      match,
    });
    console.log("----------------------");
  
    if (!match) {
      return;
    }
  
    return window.location.pathname.startsWith(`${fullUrl}`);
  };
  </code></pre>
  
  <p><code>match</code> is always null in the environment but works fine in development.</p>
  
  <p>Why would this be?</p>