Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use source maps in node js?

I stareted my node app with node index.js and got the following message:

(node:10128) UnhandledPromiseRejectionWarning: TypeError: e.reduce is not a function at Module.te (C:\Projects\myproject\node_modules\tronweb\dist\TronWeb.node.js:1:9236)

Now I'm interessted in whats happening. I've seen that there are mapping files TronWeb.node.js.map in the tronweb\dist directory. I started again using --inspect and opened the chrome dev tools. But in the console I see exactly the same message.

like image 859
MarcS82 Avatar asked Sep 07 '25 20:09

MarcS82


1 Answers

In Node v12.12.0+ sourcemaps are supported natively. Pass --enable-source-maps flag to enable them.

One caveat in Node v12.12.0 is that Error.prepareStackTrace will no longer be called when source maps are enabled. This was fixed in v12.16+.

like image 83
Zmey Avatar answered Sep 09 '25 22:09

Zmey