VS Code + Debugger for Chrome:在现有的Chrome实例中打开标签页,而不是新窗口? [英] VS Code + Debugger for Chrome: open tab in existing Chrome instance, instead of new window?

查看:231
本文介绍了VS Code + Debugger for Chrome:在现有的Chrome实例中打开标签页,而不是新窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Chrome调试器 VS代码扩大.我正在使用yarn start进行React项目,该项目在localhost:3000打开.

I am using the Debugger for Chrome VS Code extension. I am working on a React project using yarn start, which opens at localhost:3000.

我有一个正在运行的Chrome实例,可以使用我的Google帐户登录.但是,当我点击针对本地主机启动Chrome"时,该标签会在我未登录的Chrome的新实例中打开.

I have an already running instance of Chrome where I am logged in using my Google account. However when I hit "Launch Chrome against localhost", the tab opens in a new instance of Chrome where I am not logged in.

我如何强制该标签在已经运行的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}"
        },
    ]
}

推荐答案

啊-添加"userDataDir": false似乎可以解决问题. (来源)

Ah - adding "userDataDir": false seems to do the trick. (Source)

{
    // 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}",
            "userDataDir": false,
        },
    ]
}

这篇关于VS Code + Debugger for Chrome:在现有的Chrome实例中打开标签页,而不是新窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆