Mik*_*hke 6 firefox reactjs visual-studio-code
对于我的 React web 应用程序,我有一个启动配置来启动 Chrome 或 Firefox 进行调试。两者都工作得很好,除了 Firefox 在调试启动后不会恢复以前的设置(或者甚至可能不会保存它们)。
当我启动 Chrome 时,它会记住浏览器的大小和位置,并且我接受了本地主机的自签名证书。
Firefox 不会做任何事情。启动后,我总是必须重新定位窗口并再次接受自签名证书,随着时间的推移,这变得非常烦人。
这是我的启动设置:
{
"version": "0.2.0",
"configurations": [
{
"type": "firefox",
"request": "launch",
"reAttach": true,
"name": "Launch MSG on FF",
"url": "https://localhost:3001",
"webRoot": "${workspaceFolder}/src",
"clearConsoleOnReload": true,
"preLaunchTask": "tsc: watch"
},
{
"type": "chrome",
"request": "launch",
"name": "Launch MSG on Chrome",
"url": "https://localhost:3001",
"webRoot": "${workspaceFolder}/src",
"userDataDir": "${workspaceRoot}/.vscode/chrome",
"sourceMaps": true,
"preLaunchTask": "tsc: watch",
"sourceMapPathOverrides": {
"webpack:///build/*": "${webRoot}/*"
}
},
{
"type": "node",
"name": "Run Tests",
"request": "launch",
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
"args": [
"--config ${workspaceFolder}/jest.config.js"
],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true
}
]
}
Run Code Online (Sandbox Code Playgroud)
需要更改什么才能使 FF 在从 vscode 调试时也保持最后的状态?
以防万一这很重要:我在 macOS 上,调试实例的 FF 配置文件文件夹位于其中/var/folders/03/...(并且该文件夹存在并且可写)。
您正在寻找以下标志:
keepProfileChanges : true
Run Code Online (Sandbox Code Playgroud)
此外,您可以使用以下方式指定配置文件:
profile : "dev"
Run Code Online (Sandbox Code Playgroud)
而且,只需额外一点,您可以使用以下命令自动打开开发工具:
firefoxArgs : [
-devtools
]
Run Code Online (Sandbox Code Playgroud)
为简洁起见:
"configurations": [
{
"type": "firefox",
"request": "launch",
"reAttach": true,
"name": "Launch Name",
"clearConsoleOnReload": true,
"keepProfileChanges": true,
"profile": "dev",
"firefoxArgs": [
"-devtools",
]
]
Run Code Online (Sandbox Code Playgroud)
如果您需要创建配置文件的资源:参考
Firefox CLI参考
| 归档时间: |
|
| 查看次数: |
529 次 |
| 最近记录: |