title: TypeScript cannot find js module in same folder
body: <p>I am struggling to load a .js module which is in the same folder as my .ts file. I have 4 file in the same folder:</p>
  
  <p><strong>index.ts</strong></p>
  
  <pre><code>/// &lt;reference path="./node.d.ts" /&gt;
  /// &lt;reference path="./foo.d.ts" /&gt;
  
  import foo = require('./foo.js');
  </code></pre>
  
  <p><strong>node.d.ts</strong></p>
  
  <p>Copied from <a href="https://github.com/borisyankov/DefinitelyTyped/blob/master/node/node.d.ts" rel="nofollow">https://github.com/borisyankov/DefinitelyTyped/blob/master/node/node.d.ts</a></p>
  
  <p><strong>foo.d.ts</strong></p>
  
  <pre><code>declare module "foo" {
      export function hello(): void;
  }
  </code></pre>
  
  <p><strong>foo.js</strong></p>
  
  <pre><code>module.exports = {
      hello: function() {
          console.log('hello');
      }
  };
  </code></pre>
  
  <p>When I run <code>tsc index.ts --module commonjs</code>, I get the following error:</p>
  
  <pre><code>index.ts(4,22): error TS2307: Cannot find module './foo.js'.
  </code></pre>