Closed sla100 closed 4 years ago
The --enable-source-maps
is still experimental. Usage of it breaks the Error.prepareStackTrace
v8 API this module relies on (among other things).
Node.js allows you to hook in with Error.prepareStackTrace
global (https://github.com/nodejs/node/blob/cbd8d715b2286e5726e6988921f5c870cbf74127/lib/internal/errors.js#L37) but when you set --enable-source-maps
they replace the error stack functionality with something that doesn't do this (https://github.com/nodejs/node/blob/4ca61f40fed31d590e4d624551044fe7cc7efd42/lib/internal/source_map/prepare_stack_trace.js). I would assume this is a bug / accident on their part unless there is something that says otherwise.
I would suggest raising the bug on Node.js based on this.
Here is a simplified example of the underlying issue:
$ node -e 'Error.prepareStackTrace=()=>console.log("called");new Error().stack'
called
$ node -e 'Error.prepareStackTrace=()=>console.log("called");new Error().stack' --enable-source-maps
$
Keeping open for visibility
Fixed in node v13.6.0
@dougwilson Thanks for reporting to nodejs
Cum debita reverentia
Works also meanwhile with recent node v12.x versions (>= v12.16.x).
Try:
It catch: