title: typescript tsc Unexpected token { on import
body: <p>I know this is a common problem and it seems like <code>"module": "commonjs"</code> in ts config must help, but it does not.</p>
  
  <p>node <code>v11.4.0</code>,
  tsc <code>3.4.3</code></p>
  
  <p><strong>tsconfig.json</strong>: </p>
  
  <pre><code>{
     "compilerOptions": {
        "lib": [
           "es2017",
           "dom"
        ],
        "target": "es6",
        "module": "commonjs",
        "moduleResolution": "node",
        "outDir": "./build",
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "sourceMap": false,
        "rootDir": "src"
     },
     "exclude": [
        "node_modules",
        "**/*.spec.ts",
        "**/*.test.ts"]
  }
  </code></pre>
  
  <p>import in <code>.ts</code> file:</p>
  
  <pre><code>import {Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn} from "typeorm";
  </code></pre>
  
  <p><strong>build &amp; run:</strong></p>
  
  <ol>
  <li><code>tsc</code></li>
  <li><code>node build/server.js</code></li>
  </ol>
  
  <p><strong>error</strong> :</p>
  
  <pre><code>(function (exports, require, module, __filename, __dirname) { import {Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn} from "typeorm";
                                                                       ^
  
  SyntaxError: Unexpected token {
      at new Script (vm.js:83:7)
      at createScript (vm.js:267:10)
      at Object.runInThisContext (vm.js:319:10)
      at Module._compile (internal/modules/cjs/loader.js:686:28)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:734:10)
      at Module.load (internal/modules/cjs/loader.js:620:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
      at Function.Module._load (internal/modules/cjs/loader.js:552:3)
      at Module.require (internal/modules/cjs/loader.js:659:17)
      at require (internal/modules/cjs/helpers.js:22:18)
  </code></pre>
  
  <p>please help :)</p>
  
  <p><strong>Update:</strong>
  It appears only in single <code>.ts</code> file. imports in other files work fine. At the same time it is the only file which uses imports from <code>typeorm</code> module.</p>