How to print stack trace with reference to typescript source in Nest.js

For visibility purposes: adding the source-map-support NPM package allows for tracing typescript files in the stack trace.

It can be added on the command line with node -r source-map-support/register fileToRun.js or programatically with

import * as sourceMapSupport from 'source-map-support';
sourceMapSupport.install();

OR

import { install } from 'source-map-support';
install();

OR with ES6 modules

import 'source-map-support/register';

Leave a Comment