You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-7Lines changed: 19 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,13 +11,7 @@ This module provides source map support for stack traces in node via the [V8 sta
11
11
$ npm install source-map-support
12
12
```
13
13
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):
21
15
22
16
```
23
17
//# sourceMappingURL=path/to/source.map
@@ -27,6 +21,24 @@ If multiple sourceMappingURL comments exist in one file, the last sourceMappingU
27
21
respected (e.g. if a file mentions the comment in code, or went through multiple transpilers).
28
22
The path should either be absolute or relative to the compiled file.
29
23
24
+
From here you have two options.
25
+
26
+
##### Node >= 2.2.0
27
+
28
+
Node 2.2.0 added the `-r` command line argument, so if you're using 2.2.0 or greater, you can use the following to run your code.
29
+
30
+
```bash
31
+
node -r source-map-support/register compiled.js
32
+
```
33
+
34
+
##### Node < 2.2.0
35
+
36
+
Put the following line at the top of the compiled file.
37
+
38
+
```js
39
+
require('source-map-support').install();
40
+
```
41
+
30
42
It is also possible to install the source map support directly by
31
43
requiring the `register` module which can be handy with ES6:
0 commit comments