Skip to content

Commit

Permalink
Merge pull request #114 from apechimp/note-cli-option
Browse files Browse the repository at this point in the history
Add note about -r when using with node
  • Loading branch information
LinusU committed Oct 3, 2017
2 parents 0e3c066 + 3e246fe commit 646092f
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions README.md
Expand Up @@ -11,13 +11,7 @@ This module provides source map support for stack traces in node via the [V8 sta
$ npm install source-map-support
```

Source maps can be generated using libraries such as [source-map-index-generator](https://github.com/twolfson/source-map-index-generator). Once you have a valid source map, insert the following line at the top of your compiled code:

```js
require('source-map-support').install();
```

And place a source mapping comment somewhere in the file (usually done automatically or with an option by your transpiler):
Source maps can be generated using libraries such as [source-map-index-generator](https://github.com/twolfson/source-map-index-generator). Once you have a valid source map, place a source mapping comment somewhere in the file (usually done automatically or with an option by your transpiler):

```
//# sourceMappingURL=path/to/source.map
Expand All @@ -27,6 +21,22 @@ If multiple sourceMappingURL comments exist in one file, the last sourceMappingU
respected (e.g. if a file mentions the comment in code, or went through multiple transpilers).
The path should either be absolute or relative to the compiled file.

From here you have two options.

##### CLI Usage

```bash
node -r source-map-support/register compiled.js
```

##### Programmatic Usage

Put the following line at the top of the compiled file.

```js
require('source-map-support').install();
```

It is also possible to install the source map support directly by
requiring the `register` module which can be handy with ES6:

Expand Down

0 comments on commit 646092f

Please sign in to comment.