vscode debuger for chrome 使用
程序员文章站
2022-07-06 16:22:08
...
就是这个插件的用法
微软官方提供了两种默认方案
{
"version": "0.1.0",
"configurations": [
{
"name": "Launch localhost",
"type": "chrome",
"request": "launch",
"url": "http://localhost/mypage.html",
"webRoot": "${workspaceFolder}/wwwroot"
},
//第一种
{
"name": "Launch index.html",
"type": "chrome",
"request": "launch",
"file": "${workspaceFolder}/index.html"
},
//第二种
]
}
大部分同学第二种没问题。但是第一种就会出现 10000毫秒 or 连接被拒绝
的问题。原因是url没有成功配置或http服务器没有被启动。
画黑线的地方需要做一些修改
{
"name": "Launch localhost",
"type": "chrome",
"request": "launch",
"url": "http://localhost:5500",
"webRoot": "${workspaceFolder}"
},
//修改的地方不多但是比较关键
"url": "http://localhost:5500",
^ ^
localhost:如果没有特殊的需求不需要更改
5500:是下图的插件开启的web服务器
debuger for chrome 最容易被忽略的问题是这个插件并没有 web server 功能,但是想使用它
,就必须自己开启一个 web server 。 例如:nginx , apache .....
。
但是我们不用这么麻烦,只用这个插件就好live server
由于他的默认端口是5500所以上面填的端口就是5500
当一切配置好之后就可以愉快的debug了
使用之前需要关闭已经运行的chrome
推荐阅读
-
vscode使用editorconfig插件以及.editorconfig配置文件说明详解
-
VsCode之使用WebView通信详解
-
Google Chrome(谷歌浏览器)安装方法与使用技巧(图文介绍)
-
关于在vscode使用webpack指令显示"因为在此系统中禁止运行脚本"问题(完美解决)
-
selenium使用chrome浏览器测试(附chromedriver与chrome的对应关系表)
-
使用Vue开发自己的Chrome扩展程序过程详解
-
谷歌chrome浏览器有几种开发工具?chrome开发者工具使用教程
-
谷歌chrome浏览器隐身窗口模式怎么使用?
-
vue cli3.0 引入eslint 结合vscode使用
-
chrome 浏览器的使用技巧