Skip to content

Commit

Permalink
Add instructions for VS Code (#554)
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Mar 17, 2018
1 parent 47efa34 commit c882abb
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Expand Up @@ -72,6 +72,25 @@ ts-node node_modules/tape/bin/tape [...args]
gulp
```

### Visual Studio Code

Create a new node.js configuration, add `-r ts-node/register` to node args and move the `program` to the `args` list (so VS Code doesn't look for `outFiles`).

```json
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"runtimeArgs": [
"-r",
"ts-node/register"
],
"args": [
"${workspaceFolder}/index.ts"
]
}
```

## How It Works

**TypeScript Node** works by registering the TypeScript compiler for the `.ts`, `.tsx` and, with `allowJs` enabled, `.js` extensions. When node.js has a file extension registered (the `require.extensions` object), it will use the extension internally for module resolution. When an extension is unknown to node.js, it will handle the file as `.js` (JavaScript).
Expand Down

0 comments on commit c882abb

Please sign in to comment.