How to debug a Deno in VsCode
In this tutorial, we are going to learn about how to debug a deno code using the VsCode editor.
Debugging deno in VsCode
We can debug a deno in vscode by attaching a debugger manually using the launch.json
file.
Note: The official support for a debugging via plugin is currently working on click here to know more.
-
First, open the deno project in vscode.
-
Create a
.vscode
folder in the root directory. -
Now, create a
launch.json
file inside the.vscode
folder and add the following configuration.
{
"version": "0.2.0",
"configurations": [
{
"name": "Deno",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "deno",
"runtimeArgs": ["run", "--inspect-brk", "-A", "<entry-point>"], "outputCapture": "std",
"port": 9229
}
]
}
In the above code, replace the <entry-point>
with the script file path you want to debug for example
server.js
or app.js
.
- Add the breakpoints in your script file and start debugging by pressing a
shift+cmd+d
keyboard shortcut or by clicking aplay
button in the left side panel.