我的配置和工作流程。
P.S. 我在about:config
中更新了Firefox的配置,但是我没有像Google Chrome那样得到所需的简单结果。
我已经安装了以下浏览器(Ubuntu 20.04 x64):
- Firefox for Ubuntu 94.0
- Google Chrome Version 96.0.4664.45 (Official Build) (64-bit)
- Microsoft Edge Version 96.0.1054.34 (Official build) beta (64-bit)
对于所有浏览器,我都没有更改它们的配置。
我的调试扩展(仅一个):Debugger for Firefox。
我的VS Code:
Version: 1.62.3
Commit: ccbaa2d27e38e5afa3e5c21c1c7bef4657064247
Date: 2021-11-17T08:00:36.721Z
Electron: 13.5.2
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Linux x64 5.11.0-40-generic
配置
{
"configurations": [
{
"type": "firefox",
"request": "launch",
"reAttach": true,
"name": "Firefox + File",
"file": "${file}"
},
{
"type": "firefox",
"request": "launch",
"reAttach": true,
"name": "Firefox + Server",
"url": "http://localhost:8080/${fileBasename}",
"webRoot": "${workspaceFolder}/public/"
}
{
"type": "pwa-chrome",
"name": "Chrome + File",
"request": "launch",
"file": "${file}"
},
{
"type": "pwa-chrome",
"name": "Chrome + Server",
"request": "launch",
"url": "http://localhost:8080/${fileBasename}",
"webRoot": "${workspaceFolder}/public"
},
{
"name": "Edge + Server",
"request": "launch",
"type": "pwa-msedge",
"url": "http://localhost:8080/${fileBasename}",
"webRoot": "${workspaceFolder}/public",
"runtimeExecutable":"/opt/microsoft/msedge-beta/msedge"
}
]
}
我可以在公共目录下运行我的index.html
和其他HTML文件,作为本地文件和服务器页面。在我的服务器上,该文件位于public
目录中。我从根目录工作,其中包括公共目录。
我只有在使用Firefox时才遇到了一些不愉快的问题。现在它可以使用以下解决方法和上述配置:
在Firefox中开始调试的步骤:
- 使用提供的配置,如果需要,我们可以更改路径或文件 https://code.visualstudio.com/docs/editor/variables-reference。但是对于我来说,当我在URL中使用指定的文件时,例如
/index.html
,它就可以正常工作。
- 启动调试(选择配置并按F5键)。
- Firefox已经打开,但调试仍未起作用。
- 打开DevTools(F12)。 是的,没有它,调试对我来说无法工作。
- 重新加载页面(在浏览器中按F5或Ctrl + R或您的操作系统中的其他组合键)。
- 调试已成功开始,可以使用断点。
我收到了VS Code的以下消息,但它可以在没有额外路径的情况下工作:
此文件的路径未映射到Firefox加载的任何URL。要么此文件尚未被Firefox加载,要么您的调试配置需要为此文件设置pathMapping - 您认为该文件已经加载并希望让Path Mapping向导尝试为您创建pathMapping?
我对Microsoft Edge浏览器进行了一些小修复。我将浏览器的bin文件路径设置为:"runtimeExecutable":"/opt/microsoft/msedge-beta/msedge"
。