My configuration and work flow.
P.S. I updated Firefox configuration in about:config, but I didn't get a needed simple result like Google Chrome.
I have installed the following browsers (Ubuntu 20.04 x64):
- Firefox for Ubuntu 94.0
- Google Chrome Version 96.0.4664.45 (Official Build) (64-bit)
- Microsoft Edge Version 96.0.1054.34 (Official build) beta (64-bit)
For all the browsers I didn't change their configuration.
My extensions for debugging (only one): Debugger for Firefox.
My VS Code:
Version: 1.62.3
Commit: ccbaa2d27e38e5afa3e5c21c1c7bef4657064247
Date: 2021-11-17T08:00:36.721Z
Electron: 13.5.2
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Linux x64 5.11.0-40-generic
Configuration
{
"configurations": [
{
// Start Debug -> Open Firefox, Open Debug console, Click an line in JS File and F5
"type": "firefox",
"request": "launch",
"reAttach": true,
"name": "Firefox + File",
"file": "${file}"
},
{
// Start Debug -> Open Firefox, Open Debug console, Click an line in JS File and F5
"type": "firefox",
"request": "launch",
"reAttach": true,
"name": "Firefox + Server",
"url": "http://localhost:8080/${fileBasename}",
// "url": "http://localhost:8080/index.html",
"webRoot": "${workspaceFolder}/public/"
}
{
"type": "pwa-chrome",
"name": "Chrome + File",
"request": "launch",
"file": "${file}"
},
{
"type": "pwa-chrome",
"name": "Chrome + Server",
"request": "launch",
"url": "http://localhost:8080/${fileBasename}",
// "url": "http://localhost:8080", // the index file
"webRoot": "${workspaceFolder}/public"
},
{
"name": "Edge + Server",
"request": "launch",
"type": "pwa-msedge",
"url": "http://localhost:8080/${fileBasename}",
// "url": "http://localhost:8080",
"webRoot": "${workspaceFolder}/public",
"runtimeExecutable":"/opt/microsoft/msedge-beta/msedge"
}
]
}
I can run my index.html and other html files as a local file and as a server page only in the public directory. On my server the file is in the public directory. I work from the root directory where the public directory is in it.
I have some unpleasant problems only with Firefox. Now it works with the following workaround and the configuration above.
Steps to start debugging in Firefox:
- Use the provided configuration and we can change paths or files if it needs. https://code.visualstudio.com/docs/editor/variables-reference But for me it works when I use specified file in the URL, for example,
/index.html.
- Start the debugging (choose the configuration and press F5).
- Firefox have been opened, but the debugging hasn't still worked.
- Open DevTools (F12). Yes, without it the debugging doesn't work for me.
- Reload the page (press F5 in the browser or Ctrl+R or another combination in your OS).
- Debugging has been started with your breakpoints.
I have got the following message of VS Code, but it works without additional paths:
This file's path isn't mapped to any url that was loaded by Firefox. Either this file hasn't been loaded by Firefox yet or your debug configuration needs a pathMapping for this file - do you think the file has already been loaded and want to let the Path Mapping Wizard try to create a pathMapping for you?
I have had a little fix for the Microsoft Edge browser. I set a path to the bin file of the browser: "runtimeExecutable":"/opt/microsoft/msedge-beta/msedge".