title: How does JavaScript import find the module without an extension?
body: <p>I understand that we can use <code>import {x} from &quot;./file&quot;</code> and a variable <code>x</code> will be imported from <code>file.js</code> in the same directory. How is this handled if there are files of the same name with different extensions in the directory?</p>
  <p>For example, if there were <code>file.js</code> and <code>file.ts</code> in the same directory, how would <code>import {x} from &quot;./file&quot;</code> behave? Would it depend on the version of JavaScript?</p>