我正在尝试使用React Dev Tools和Firefox Developer Edition调试React应用。通过VSCode启动Firefox时,我无法将React Dev Tools安装到Firefox使用的配置文件中。我通过在/ Applications中打开Firefox本身启动时安装了React Dev Tools。
但是,当我运行以下launch.json
配置文件时,FireFox启动后,首选项->扩展和主题->扩展中没有显示任何扩展。
{
"name": "Launch localhost",
"type": "firefox",
"request": "launch",
"reAttach": true,
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
},
但是,我可以按照此处的说明操作,并通过终端启动Firefox,并将调试器连接到该终端。此配置文件具有React Dev Tools,并且可以正常运行:
/Applications/Firefox\ Developer\ Edition.app/Contents/MacOS/firefox -start-debugger-server
launch.json:
{
"name": "Attach",
"type": "firefox",
"request": "attach",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
},
但是,如何使第一个与launch
请求一起使用attach
呢?通过阅读似乎与个人资料有关
我有同样的问题,可以通过添加到launch.json中来解决:
"profile": "my-firefox-profile"
Firefox可以安装多个配置文件。您可以通过about:profiles
在firefoxes地址栏中输入内容进行检查。它将显示一个配置文件列表。标为的Default profile: yes
应为选择的一项。
我的launch.json现在看起来像这样:
{
"name": "Firefox",
"type": "firefox",
"request": "launch",
"reAttach": true,
"url": "http://localhost:4300",
"webRoot": "${workspaceFolder}",
"profile": "default-release-1"
},
背景:
Firefox配置文件包含诸如浏览历史记录,书签(最重要的是附件)之类的设置。通过告诉VSCode使用特定的配置文件,它可与已安装的插件一起使用。
如果您对Angular或Vue有相同的问题,这也将起作用。