Skip to content

Commit 78d308f

Browse files
Fabian Wilesalexeagle
authored andcommitted
feat(docs): add vscode debugging section
1 parent 32c003f commit 78d308f

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

commitlint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ module.exports = {
2020
'terser',
2121
'typescript',
2222
'worker',
23+
'docs',
2324
]
2425
]
2526
}

docs/index.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,35 @@ A Chrome DevTools window should open and you should see `Debugger attached.` in
124124

125125
See https://nodejs.org/en/docs/guides/debugging-getting-started/ for more details.
126126

127+
### Debugging with VS Code
128+
129+
With the above configuration you can use VS Code as your debugger.
130+
You will first need to configure your `.vscode/launch.json`:
131+
132+
```
133+
{
134+
"type": "node",
135+
"request": "attach",
136+
"name": "Attach nodejs_binary",
137+
"internalConsoleOptions": "neverOpen",
138+
"sourceMapPathOverrides": {
139+
"../*": "${workspaceRoot}/*",
140+
"../../*": "${workspaceRoot}/*",
141+
"../../../*": "${workspaceRoot}/*",
142+
"../../../../*": "${workspaceRoot}/*",
143+
"../../../../../*": "${workspaceRoot}/*",
144+
// do as many levels here as needed for your project
145+
}
146+
```
147+
We use `sourceMapPathOverrides` here to rewrite the source maps produced by `ts_library` so that breakpoints line up with the source maps.
148+
Once configured start your process with
149+
```
150+
bazel run --config=debug //test:test1
151+
```
152+
Then hit `F5` which will start the VS Code debugger with the `Attach nodejs_binary` configuration.
153+
VS Code will immediatenly hit a breakpoint to which you can continue and debug using all the normal debug features provided.
154+
155+
127156
### Stamping
128157

129158
Bazel is generally only a build tool, and is unaware of your version control system.

0 commit comments

Comments
 (0)