我只是想调试我HTML页面中的一些JavaScript。
我将配置设置如下:
但是,当我调试html页面时(使用第二个选项“启动div.html”),它可以运行,但是我无法设置断点...
有任何想法吗?
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080/",
"webRoot": "${workspaceFolder}"
},
{
"type": "chrome",
"request": "launch",
"name": "Launch the div.html",
"sourceMaps": true,
"file": "${workspaceFolder}/div.html",
"webRoot": "${workspaceFolder}"
}
]
}
似乎不支持调试嵌入式JavaScript(我也无法设置断点)。您必须将JS代码分离到其自己的文件中,并将其包含在div.html中,如下所示:<script src="div.js"></script>
现在在div.js中设置断点并开始调试。当我第一次运行调试时遇到断点未加载的问题。我可以解决的是单击绿色的“重新启动”调试按钮。
PS:您需要安装Debugger for Chrome扩展程序,但是看来您已经完成了。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句