使用VS Code调试JavaScript代码
安装Debugger for Chrome
或者Debugger for Firefox
插件
按下图步骤操作,选择你想使用的浏览器
选择完成后他会生成一个launch.json文件
添加
"file": "${workspaceFolder}/index.html"
完整的launch.json为:
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}",
"file": "${workspaceFolder}/index.html"
}
]
}
然后就可以启动调试了