TSR
TSR

Reputation: 20446

How to map compiled JS errors trace to Typescript code?

In my project, I have an /src folder that contains .ts files and I setup tsconfig.json to compile those in a folder called /dist into .js and source map .js.map.

Now I run the code using the commande node /dist/whatever.js But Let's say there in a error. The error logs maps to the compiled .js files. enter image description here How to make it map to the original .ts file ? I assume this is possible because that's the use of source map.

erro

Upvotes: 0

Views: 1162

Answers (2)

Yuxuan Xie
Yuxuan Xie

Reputation: 61

Happened to see this question. I didn't really use IntelliJ, but I have been using source-map-support to do the trick. You could either programmtically add import 'source-map-support/register';, or invoke node CLI node -r source-map-support/register compiled.js. Hope that helps.

Upvotes: 1

hurricane
hurricane

Reputation: 6734

I see you are using IntelliJ. You can exclude directories so they will not be indexed.

enter image description here

Upvotes: -1

Related Questions