title: Uncaught ReferenceError: exports is not defined when importing function - TypeScript
body: <p>I'm learning TypeScript. I imported the <code>output</code> function from <code>console.ts</code>:</p>
  
  <pre><code>export function output(value: any): void {
    console.log(value);
  }
  </code></pre>
  
  <p>Which compiles to <code>console.js</code>:</p>
  
  <pre><code>"use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  var console_1 = require("./console");
  console_1.output('Hello');
  //# sourceMappingURL=functional.js.map
  </code></pre>
  
  <p>Importing and usage in destination file:</p>
  
  <pre><code>import {output} from "./console";
  output('Hello');
  </code></pre>
  
  <p><strong>tsconfig.json:</strong></p>
  
  <pre><code>{
    "compilerOptions": {
      "target": "es5",
      "module": "commonjs",
      "noImplicitAny": true,
      "removeComments": true,
      "preserveConstEnums": true,
      "sourceMap": true
    },
    "exclude": [
      "node_modules"
    ]
  }
  </code></pre>
  
  <p>I got no compiling error, but not understanding why I got the following error in the browser:</p>
  
  <p><a href="https://i.stack.imgur.com/BBqBs.png" rel="noreferrer"><img src="https://i.stack.imgur.com/BBqBs.png" alt="enter image description here"></a></p>
  
  <pre><code>Uncaught ReferenceError: exports is not defined at functional.js:2
  </code></pre>