Skip to content

Commit 646092f

Browse files
authored
Merge pull request #114 from apechimp/note-cli-option
Add note about -r when using with node
2 parents 0e3c066 + 3e246fe commit 646092f

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

README.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@ This module provides source map support for stack traces in node via the [V8 sta
1111
$ npm install source-map-support
1212
```
1313

14-
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:
15-
16-
```js
17-
require('source-map-support').install();
18-
```
19-
20-
And place a source mapping comment somewhere in the file (usually done automatically or with an option by your transpiler):
14+
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):
2115

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

24+
From here you have two options.
25+
26+
##### CLI Usage
27+
28+
```bash
29+
node -r source-map-support/register compiled.js
30+
```
31+
32+
##### Programmatic Usage
33+
34+
Put the following line at the top of the compiled file.
35+
36+
```js
37+
require('source-map-support').install();
38+
```
39+
3040
It is also possible to install the source map support directly by
3141
requiring the `register` module which can be handy with ES6:
3242

0 commit comments

Comments
 (0)