Persist Extensions on launch
{
// 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": [
{
"name": "Hello",
"type": "firefox",
"request": "launch",
"reAttach": true,
"url": "http://localhost:4000/",
}
]
}
Under launch mode, a fresh Firefox instance is opened, one with no account synced and no extensions. Is there an override or anything of some sort that lets "launch" launch a browser instance that's just like a regular launch with remote debugging enabled?
Yes, by default this extension will create a temporary Firefox profile for debugging in launch mode. The reason for this is that the permission to control Firefox with an external debugger is permanently stored in that profile - and that shouldn't be done to your default profile because it would create a security risk for your browser. But you can change that:
- you can set
profileto the name of a profile (the default profile is usually calleddefault, but you can create more with the Profile Manager): this will make a temporary copy of that profile every time you start a debugging session. Only downside: sometimes profiles can become quite large and in that case creating a copy every time you start debugging can become a performance issue. - if you additionally set
keepProfileChangestotrue, this extension will work directly with the given profile (instead of copying it), permanently modifying it to allow external debugging. Only downside: since you shouldn't do that with your default profile, you need to open the Profile Manager and create a profile for debugging first - instead of the
profilesetting you can also useprofileDir: this will let you use any directory as a profile directory. Especially useful together withkeepProfileChanges: just start with an empy directory and it will automatically be turned into your debugging profile
@hbenl Thanks for the detailed reply.
Do you know how "transferrable" this is? We have a central repository setup with multiple developers with different OSes, or would we have to find another way (like multiple launch.json configs etc.)? How does it handle a profile or profileDir that doesn't exist?
If profileDir points to a non-existent directory, it will be created. So for your situation you could set
"profileDir": "${workspaceFolder}/.firefox-profile",
"keepProfileChanges": true
This should work on all OSes. You should then also add that directory to .gitignore so that nobody accidentally commits the profile to the repository.