Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple projects running at the same time with VSCode extension Debugger for Chrome

I have 2 projects (React projects) that I would like to be able to debug at the same time when using VS Code. The launch configurations for the projects are like this:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "chrome",
      "request": "launch",
      "name": "Project A",
      "url": "http://localhost:3003",
      "webRoot": "${workspaceFolder}"
    }
  ]
}

And

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "chrome",
      "request": "launch",
      "name": "Project B",
      "url": "http://localhost:3001",
      "webRoot": "${workspaceFolder}"
    }
  ]
}

If I launch any of the projects individually it all works fine. But if I try to launch one while the other is already running I get this:

enter image description here

So the question is, how should I make the setup so I can debug multiple projects in VS Code that use the Debugger for Chrome extension?

like image 925
Daniel Sindrestean Avatar asked Dec 28 '25 19:12

Daniel Sindrestean


1 Answers

I have had the same issue because it worked with an older version of vscode-debgger. I open the folder which contains both project and run it with a config like this:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "chrome",
      "request": "launch",
      "name": "Project A and B",
      "url": "http://localhost:3001",
      "urlFilter": "http://localhost:*",
      "pathMapping": {
           "http://localhost:3001": "${workspaceFolder}/projectA",
           "http://localhost:3003": "${workspaceFolder}/projectB"
      }
    }
  ]
}

When Chrome starts you still have to manually open the second tab with http://localhost:3003.

like image 83
Fluchaa Avatar answered Dec 30 '25 22:12

Fluchaa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!