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
.
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.
How do I force the tab to open in my already-running instance of Chrome instead?
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}"
},
]
}
To debug any project in either Chrome or Microsoft Edge, all you need to do is to start a session by pressing F5 or activating the debug icon in the menu bar and selecting “Run and debug”. Alternatively, you can also use the Visual Studio Code command palette and run the “Debug: Open Link” command.
Previously this can be done via Debugger for Chrome plugin. But this plugin is now deprecated and not working properly.
In the “Search Settings” bar, type Live Server. Search “Live Server” in the Search Settings bar. From the Custom Browser option, select the browser you want for the Live Server – we'll select “chrome” for this guide. Choose your preferred browser from the Custom Browser settings.
The following guide was helpful, basically you want to use "request": "attach"
not "request": "launch"
.
https://www.freecodecamp.org/news/how-to-set-up-the-debugger-for-chrome-extension-in-visual-studio-code-c0b3e5937c01/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With