ts-node
ts-node copied to clipboard
Research usability of `--enable-source-maps`
In the past, node's built-in --enable-source-maps had bugs / missing features and performance issues. But things may have changed.
In #2009 @isaacs found that @cspotcode/source-map-support is not working in node 20. Maybe to do with installing it in both the loader and main threads, or to do with the source cache populating in one thread but the stack traces being mapped in another?
https://discord.com/channels/508357248330760243/933130253692436560/1147324780920459344
Correctness test and benchmark
Here is a benchmark that I used to compare the correctness and performance of different sourcemap implementations. https://github.com/cspotcode/source-map-performance-demo#example-output https://github.com/evanw/node-source-map-support/issues/122#issuecomment-1079433868
Async frames rendering incorrectly
https://github.com/nodejs/node/issues/42417
async stack frames weren't rendering correctly I linked the test & benchmark as evidence
Callsite vs callee function names
Some sourcemappers map function names to the callsite (wrong), not the callee. Meaning stack frames show the wrong function name https://github.com/jestjs/jest/pull/12786#issuecomment-1115474383
However, @cspotcode/source-map-support also doing this wrong?
I updated the benchmark results: https://github.com/cspotcode/source-map-performance-demo#example-output
Async stack traces still render incorrectly. But node 19 resolved the performance issue with large sourcemaps.