title: typescript Unexpected token import
body: <p>I get the following error when using a simple <code>import</code> in a node.js base code.
  I would like to know what is wrong in my config files and how to fix it:</p>
  
  <p>Error I receive:</p>
  
  <pre><code>(function (exports, require, module, __filename, __dirname) { import { IO } from "fp-ts/lib/IO";
                                                                ^^^^^^
  
  SyntaxError: Unexpected token import
  </code></pre>
  
  <p>I am using typescript, here my config files:</p>
  
  <p>tsconfig.json</p>
  
  <pre><code>{
      "compilerOptions": {
          "target": "es2017",
          "module": "commonjs",
          "sourceMap": true,
          "strict": true,
          "noUnusedLocals": true,
          "noUnusedParameters": true,
          "noImplicitReturns": true,
          "noFallthroughCasesInSwitch": true,
          "moduleResolution": "node",
          "baseUrl": "."
      }
  }
  </code></pre>
  
  <p>webpack.config.js</p>
  
  <pre><code>const path = require('path');
  
  module.exports = {
    entry: 'index.ts',
    devtool: 'source-map',
    module: {
      rules: [
        {
          test: /\.tsx?$/,
          use: 'ts-loader',
          exclude: /node_modules/
        }
      ]
    },
    resolve: {
      extensions: [ '.ts' ]
    },
    output: {
      filename: 'bundle.js',
      path: path.resolve(__dirname, 'dist')
    }
  };
  </code></pre>
  
  <p>package.json</p>
  
  <pre><code>"devDependencies": {
      "@types/node": "^10.9.4",
      "jest": "^23.5.0",
      "prettier": "^1.14.2",
      "ts-loader": "^5.1.0",
      "webpack": "^4.18.0"
    }
  </code></pre>
  
  <p>...</p>
  
  <pre><code>  "dependencies": {
      "fp-ts": "^1.8.0",
      "typescript": "^3.0.3"
    },
  </code></pre>