title: Typescript: Unexpected token import
body: <p>Just started working with typescript. Unfortunately when I try to build for production it fails.</p>
  
  <p>Firstly I run</p>
  
  <p><code>tsc</code></p>
  
  <p>This passes without any error, but when I try to run the build file I get import errors</p>
  
  <p><code>node build/index.js</code></p>
  
  <p>The error I get is below:</p>
  
  <pre><code>[0] (function (exports, require, module, __filename, __dirname) { import {
  [0]                                                               ^^^^^^
  [0]
  [0] SyntaxError: Unexpected token import
  [0]     at createScript (vm.js:80:10)
  [0]     at Object.runInThisContext (vm.js:139:10)
  </code></pre>
  
  <p>Below is my tsconfig</p>
  
  <pre><code>{
      "include": [
          "src/**/*"
      ],
      "exclude": [
          "node_modules",
          "**/*.spec.ts"
      ],
     "compilerOptions": {
          "lib": [
              "es5",
              "es6",
          ],
          "pretty": true,
          "target": "es5",
          "module": "commonjs",
          "outDir": "./build",
          "moduleResolution": "node",
          "emitDecoratorMetadata": true,
          "experimentalDecorators": true,
          "allowSyntheticDefaultImports": true,
          "sourceMap": true
     }
  }
  </code></pre>
  
  <p>I am using node <code>v8.9.3</code></p>