From 83063f7dd8ba4d9bc67fd0490486196e0f7b3a87 Mon Sep 17 00:00:00 2001 From: Jiri Spac Date: Tue, 29 Mar 2022 17:06:18 +0200 Subject: [PATCH 1/2] docs: compare with the --enable-source-maps --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 40228b7..e67ffe0 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,11 @@ This module provides source map support for stack traces in node via the [V8 stack trace API](https://github.com/v8/v8/wiki/Stack-Trace-API). It uses the [source-map](https://github.com/mozilla/source-map) module to replace the paths and line numbers of source-mapped files with their original paths and line numbers. The output mimics node's stack trace format with the goal of making every compile-to-JS language more of a first-class citizen. Source maps are completely general (not specific to any one language) so you can use source maps with multiple compile-to-JS languages in the same node process. +## Compared to --enable-source-maps + +Node.js has a CLI flag `--enable-source-maps` which can be used to enable source maps support without needing to install any additional module. Just beware that it slows down startup of your app considerably more than this module. +For example a bigger Typescript project startup is slowed down by 0.2 seconds with this module. When running with the `--enable-source-maps` startup is 12.1 seconds slower. + ## Installation and Usage #### Node support From 6ca2daea6967466983023307e62851012a8e87a6 Mon Sep 17 00:00:00 2001 From: Jiri Spac Date: Tue, 29 Mar 2022 17:14:03 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e67ffe0..e88f461 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,11 @@ This module provides source map support for stack traces in node via the [V8 sta ## Compared to --enable-source-maps -Node.js has a CLI flag `--enable-source-maps` which can be used to enable source maps support without needing to install any additional module. Just beware that it slows down startup of your app considerably more than this module. +Node.js has a CLI flag `--enable-source-maps` which can be used to enable source maps support without needing to install any additional module. Notable differences: + 1. **performance** - beware that it slows down startup of your app considerably more than this module. For example a bigger Typescript project startup is slowed down by 0.2 seconds with this module. When running with the `--enable-source-maps` startup is 12.1 seconds slower. + 2. **stack traces** - with this module shows just the mapped lines. Node.js source map support includes the lines from the `js` file which is executed and underneath the mapped source location. +If you relly on stack traces in your runtime code, you should be careful about mixing the two ways. ## Installation and Usage