3pepe3
3pepe3

Reputation: 613

run vscode chrome debugger with its extensions

Is there any way we can launch the chrome window with all the extensions installed on chrome?

{
    "version": "0.2.0",
    "configurations": [{
        "type": "chrome",
        "request": "launch",
        "name": "Launch Chrome against localhost",
        "url": "http://site.example.com/",
        "webRoot": "${workspaceFolder}"
    }]
}

Upvotes: 26

Views: 7928

Answers (2)

Jeff Mercado
Jeff Mercado

Reputation: 134801

Setting the userDataDir property in the launch config to false will allow you to launch Chrome using your personal user profile. However, I would suggest keeping your debugging environment sandboxed and separated from your personal profile instead.

By default, Chrome debugger will create a new profile for your debugging session and will persist until you restart your computer. The profile directory will be in your %TEMP% folder. The trick here is to create a profile just for your workspace. You could then configure this profile to have whatever extensions and other settings that you need. We just need to make it persist permanently by specifying a different location.

Instead, set the userDataDir property to a path in your .vscode directory (and ignore in your source control). It will create the profile in that directory you set. I use:

${workspaceFolder}/.vscode/vscode-chrome-debug-userdatadir

Then when you run the debugger, it will create a profile in that directory that should persist indefinitely. You could then install all the extensions you want, all without muddying up your personal profile.

If you want a central debugging workspace to be used for multiple projects, you could put it in your home folder (or other location) rather than your project workspace.

${env:HOME}/.vscode/vscode-chrome-debug-userdatadir

Upvotes: 58

Skylark
Skylark

Reputation: 169

One way is to prevent the debugger from starting a chrome instance with a seperate profile.

Just add "userDataDir": false within "configurations" to your launch.json. Close all Chrome instances, than start debugging from Visual Studio Code.

Your previous chrome session should open including a new Tab serving your files.

Afterwards you can start/stop debugging without closing and reopening chrome.

Source: https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome

Upvotes: 14

Related Questions