title: @types/react-router-dom gives errors when vite build
body: <p>I am making a react app with vite and typescript. When I use &quot;vite&quot; for development, it works fine. But when I use &quot;tsc &amp;&amp; vite build&quot;, @types/react-router-dom and @types/react-router throws hundreds of errors, such as</p>
  <blockquote>
  <p>node_modules/@types/react-router-dom/index.d.ts:13:10 - error TS2305: Module '&quot;react-router&quot;' has no exported member 'match'.</p>
  </blockquote>
  <p>package.json</p>
  <pre><code>{
    &quot;name&quot;: &quot;client&quot;,
    &quot;version&quot;: &quot;1.0.0&quot;,
    &quot;description&quot;: &quot;&quot;,
    &quot;scripts&quot;: {
      &quot;dev&quot;: &quot;vite&quot;,
      &quot;build&quot;: &quot;tsc &amp;&amp; vite build&quot;,
      &quot;serve&quot;: &quot;vite preview&quot;
    },
    &quot;dependencies&quot;: {
      &quot;react&quot;: &quot;^17.0.2&quot;,
      &quot;react-dom&quot;: &quot;^17.0.2&quot;,
      &quot;react-router-dom&quot;: &quot;^6.0.2&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;@types/react&quot;: &quot;^17.0.37&quot;,
      &quot;@types/react-dom&quot;: &quot;^17.0.11&quot;,
      &quot;@types/react-router-dom&quot;: &quot;^5.3.2&quot;,
      &quot;@vitejs/plugin-react-refresh&quot;: &quot;^1.3.6&quot;,
      &quot;autoprefixer&quot;: &quot;^10.4.0&quot;,
      &quot;postcss&quot;: &quot;^8.4.3&quot;,
      &quot;sass&quot;: &quot;^1.43.5&quot;,
      &quot;tailwindcss&quot;: &quot;^2.2.19&quot;,
      &quot;typescript&quot;: &quot;^4.5.2&quot;,
      &quot;vite&quot;: &quot;^2.6.14&quot;
    }
  }
  </code></pre>
  <p><strong>Usage of react-router-dom</strong></p>
  <p>App.tsx</p>
  <pre><code>import React from 'react'
  import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'
  import Nav from './components/Nav'
  
  export default function App() {
      return (
          &lt;&gt;
              &lt;Router&gt;
                  &lt;Nav/&gt;
                  &lt;Routes&gt;
                      &lt;Route path=&quot;/&quot;&gt;&lt;/Route&gt;
                  &lt;/Routes&gt;
              &lt;/Router&gt;
          &lt;/&gt;
      )
  }
  </code></pre>
  <p>Nav.tsx</p>
  <pre><code>import React from 'react'
  import { Link } from 'react-router-dom'
  import Logo from '../media/profile1.jpg'
  import 'Nav.scss'
  
  export default function Nav() {
      return (
          &lt;&gt;
              &lt;header className=&quot;fixed top-0 left-0 flex flex-row items-center bg-gradient-to-r from-violet-700 via-indigo-700 to-blue-700 w-screen&quot; style={{ height: '20vh' }}&gt;
                  &lt;Link to='/' className=&quot;h-2/3 md:h-4/5 mx-4&quot;&gt;
                      &lt;img className=&quot;h-full rounded-3xl&quot; src={Logo} alt=&quot;&quot; /&gt;
                  &lt;/Link&gt;
                  &lt;div className=&quot;h-2/3 md:h-4/5 mx-4 flex items-center justify-center text-white font-bold text-7xl title&quot;&gt;
                  &lt;/div&gt;
              &lt;/header&gt;
              &lt;div style={{ marginBottom: '20vh' }} &gt;&lt;/div&gt;
          &lt;/&gt;
      )
  }
  </code></pre>