title: How to print stack trace with reference to typescript source in Nest.js
body: <p>I am developing a Nest.js server and would like to be able to print useful stack trace in console (e.g. console.log). By default, it returns a reference to the line number in the compiled sources (.js). This is not useful for debugging as it's missing the reference to the line number in the original source files (.ts)</p>
  <p>Here is my tsconfig.json</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;compilerOptions&quot;: {
      &quot;module&quot;: &quot;commonjs&quot;,
      &quot;declaration&quot;: true,
      &quot;removeComments&quot;: true,
      &quot;emitDecoratorMetadata&quot;: true,
      &quot;experimentalDecorators&quot;: true,
      &quot;target&quot;: &quot;es2017&quot;,
      &quot;sourceMap&quot;: true,
      &quot;outDir&quot;: &quot;./dist&quot;,
      &quot;_baseUrl&quot;: &quot;./&quot;,
      &quot;incremental&quot;: true
    },
    &quot;exclude&quot;: [&quot;node_modules&quot;, &quot;dist&quot;]
  }
  </code></pre>
  <p>The .map files are generated in the dist folder as well, though it seems to be of no use when checking stack traces in the console.</p>