title: PhpStorm can't resolve package import even though it exists (react-router-dom)
body: <p>I am using React (16.12.0) with PhpStorm (2019.3.1).</p>
  
  <p>The package I am importing is react-router-dom (5.1.2)</p>
  
  <p>I will write the following import:</p>
  
  <pre><code>import { NavLink, Switch } from "react-router-dom";
  </code></pre>
  
  <p>Both packages are imported properly by webpack/babel and the page renders properly when I use both Switch and NavLink.</p>
  
  <p>However purely from the IDE-perspective, I get a warning about Switch: <code>Cannot resolve symbol 'Switch'</code></p>
  
  <p>It is weird because it is obviously there, and I checked in <code>/node_modules/react-router-dom</code> and <code>Switch.js</code> is there.</p>
  
  <p>Strangely on previous versions of PhpStorm (before several updates and plugin imports and other changes), the Switch import was accurately found by PhpStorm.</p>
  
  <p>I have not updated react-router-dom recently and am using its latest stable build.</p>
  
  <p>Any ideas as to why it might be missing Switch?</p>
  
  <p><strong>EDIT:</strong>
  I have realized it may be because PhpStorm is having difficulty importing a commonJS module.</p>
  
  <p>I tried changing the Javascript compilation method from React JSX to ECMA 6. That didn't work.</p>
  
  <p>I also tried importing some build libraries for react-router-dom, and that worked for recognizing the <code>Route</code> import strangely but not <code>Switch</code>.</p>
  
  <p>I also tried invalidating the PhpStorm cache and restarting the app, but that didn't work either.</p>
  
  <p><strong>EDIT 2:</strong>
  Per an answer, I have tried to use option+enter (alt+enter on windows) while my cursor is within <code>react-router-dom</code> to try to install a typescript package, but I don't get the same suggested action as shown on the JetBrains website: <a href="https://www.jetbrains.com/help/webstorm/configuring-javascript-libraries.html" rel="nofollow noreferrer">https://www.jetbrains.com/help/webstorm/configuring-javascript-libraries.html</a></p>
  
  <p>All it suggests is switching single quotes to double quotes.</p>
  
  <p><a href="https://i.stack.imgur.com/EkzHh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EkzHh.png" alt="enter image description here"></a></p>
  
  <p>Also I have already installed @types/react-router-dom. Perhaps there is another one that I am missing?</p>
  
  <p><a href="https://i.stack.imgur.com/zKCs1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zKCs1.png" alt="enter image description here"></a></p>
  
  <p><strong>EDIT 3:</strong>
  The correct answer was to install <code>@types/react-router</code>. For some reason <code>@types/react-router-dom</code> is deceivingly NOT what solves this.</p>