title: Cannot find module from "undefined"
body: <p>I am trying to import an external module inside my Sublime Text 3. The external module <strong>Ship.ts</strong> is a s follows:</p>
  
  <pre><code>export interface Ship {
      name: string;
      port: string;
      displacement: number;
  }
  </code></pre>
  
  <p>The <strong>output.ts</strong> file contains <strong>import Ship = require("./Ship");</strong> and this file gets saved and built error-free. The <strong>tsconfig.json</strong> is as follows:</p>
  
  <pre><code>{
      "compileOptions": {
          "module": "commonjs"
      },
      "files": [
          "./Ship.ts"
      ]
  }
  </code></pre>
  
  <p>However, when viewed inside and index php page:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;script src="node_modules/commonjs-require/commonjs-require.js"&gt;&lt;/script&gt;
          &lt;script src="output.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          Hello TypeScript
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>... there is a console error saying <code>commonjs-require.js:15 Uncaught Error: Cannot find module "./Ship" from "undefined"</code>. The .ts and .js files along with the tsconfig.json file are all in the same directory. Any help appreciated.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Even if I change the contents of <strong>Ship.ts</strong> to:</p>
  
  <pre><code>export function greet(): void {
      console.log("Hello Ship");
  } 
  </code></pre>
  
  <p>... which transpiles to:</p>
  
  <pre><code>"use strict";
  function greet() {
      console.log("Hello Ship");
  }
  exports.greet = greet;
  </code></pre>
  
  <p>... the error message <code>commonjs-require.js:15 Uncaught Error: Cannot find module "./Ship" from "undefined"</code> is unfortunately still on after trying to access it through either <strong>import Ship = require("./Ship")</strong> or <strong>import {Ship} from "./Ship".</strong></p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Also tried to include <code>///&lt;reference path="Ship.ts" /&gt;</code> or <code>///&lt;reference path="./Ship.ts" /&gt;</code> at the top of <strong>output.ts</strong> but to no avail.</p>