如何在vscode中调试代码

Step 1: set a debug configration on /.vscode/launch.json, like this:

"configurations": [
{
"name": "Launch Chrome For Debug",
"type": "chrome",
"request": "launch",
"url": "http://localhost:8000",
"sourceMaps": true,
"webRoot": "${workspaceRoot}",
"userDataDir": "${workspaceRoot}/.vscode/chrome"
}
]

step 2 : In vscode's terminal, run >npm start . The default browser will auto open http://localhost:8000

step 3 : Open VSCode's debug panel, choose the "Launch Chrome For Debug" and click the Debug button. A chrome browser will be opened.

原文地址:https://www.cnblogs.com/cuoreqzt/p/10530035.html