Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: compare with the --enable-source-maps #313

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

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. 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

#### Node support
Expand Down