对于 Visual Studio 代码(不是 Visual Studio),请执行 Ctrl+Shift+P
在搜索栏中输入 Debugger for Chrome,安装并启用它。
在您的 launch.json 文件中添加此配置:
{
"version": "0.1.0",
"configurations": [
{
"name": "Launch localhost with sourcemaps",
"type": "chrome",
"request": "launch",
"url": "http://localhost/mypage.html",
"webRoot": "${workspaceRoot}/app/files",
"sourceMaps": true
},
{
"name": "Launch index.html (without sourcemaps)",
"type": "chrome",
"request": "launch",
"file": "${workspaceRoot}/index.html"
},
]
}
您必须启动 Chrome 并启用远程调试才能附加扩展程序。
右键单击 Chrome 快捷方式,然后选择属性
在“目标”字段中,附加 --remote-debugging-port=9222
或者在命令提示符下,执行 /chrome.exe --remote-debugging-port=9222
在终端中,执行 /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
在终端中,启动 google-chrome --remote-debugging-port=9222
Find More ===>