VS Code + Debugger for Chrome:在现有 Chrome 实例中打开选项卡,而不是新窗口?

Posted

技术标签:

【中文标题】VS Code + Debugger for Chrome:在现有 Chrome 实例中打开选项卡,而不是新窗口?【英文标题】:VS Code + Debugger for Chrome: open tab in existing Chrome instance, instead of new window? 【发布时间】:2020-11-26 22:06:49 【问题描述】:

我正在使用Debugger for Chrome VS 代码扩展。我正在使用 yarn start 开发一个 React 项目,该项目在 localhost:3000 打开。

我已经使用我的 Google 帐户登录了一个正在运行的 Chrome 实例。但是,当我点击“针对 localhost 启动 Chrome”时,该选项卡会在我未登录的新 Chrome 实例中打开。

我该如何强制标签在我已经运行的 Chrome 实例中打开

launch.json:


    // 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:3000",
            "webRoot": "$workspaceFolder"
        ,
    ]

【问题讨论】:

您找到解决方案了吗?我陷入了同样的境地。请发布您找到的任何解决方案/解决方法。这会很有帮助。 我将其发布为对我自己的 q 的回答,但它一直被否决,因此我将其删除。继续看看它是否适合你(添加"userDataDir": false):briandesousa1.wordpress.com/2018/05/12/… 【参考方案1】:

以下指南很有帮助,基本上你想使用"request": "attach" 而不是"request": "launch"

https://www.freecodecamp.org/news/how-to-set-up-the-debugger-for-chrome-extension-in-visual-studio-code-c0b3e5937c01/

【讨论】:

以上是关于VS Code + Debugger for Chrome:在现有 Chrome 实例中打开选项卡,而不是新窗口?的主要内容,如果未能解决你的问题,请参考以下文章

深度剖析 VS Code JavaScript Debugger 功能及实现原理

在 VS Code-debugger 中,如何在 nodejs 的 launch.json 中使用 envFile?

VS Code 调试树莓派上的python程序

visual studio code 中 debugger for chrome插件怎样配置使用

VS Code怎样设置成中文

VS code for python开发利器