@@ -124,6 +124,35 @@ A Chrome DevTools window should open and you should see `Debugger attached.` in
124124
125125See 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
129158Bazel is generally only a build tool, and is unaware of your version control system.
0 commit comments