I am using Edge extension. Below is configuration in launch.json
:
"configurations": [
{
"name": "ng serve",
"type": "edge",
"request": "launch",
"url": "http://localhost:4200/",
"webRoot": "${workspaceFolder}",
"sourceMaps": true
}]
Here is more detailed steps as per documentation in VS Code:
I tried clearing all breakpoints, restarting vs code(and machine), closing all browser instances, but still getting same behaviour. Debugger is able to launch the angular app in browser but unable to hit the breakpoints.
So, is there is any other configuration to make it work with Edge browser. The current configuration works fine with chrome browser (just replace edge with chrome in launch.json).
Debug Angular in VS Code 1 Step 1: Create an Angular application; 2 Step 2: Install Debugger for Chrome (you could install other debuggers you like) 3 Step 3: Configure Debug Environment; 4 Step 4: Start Debugging; More ...
On the VSCode, click the view menu, and select the extension options to check whether you have already installed the Debugger for Edge extension, and already enable it. Then, press Reload to restart VS Code and activate the extension.
The key point in both processes is to have webpack dev server and VSCode debugger running at the same time. In your launch.json file add the following configuration: Go to VSCode debugger and run "Angular debugging session" configuration. As a result, new browser window with your application will be opened.
Visual Studio Code includes a built-in debugger for Microsoft Edge, which can launch the browser or attach to an already running browser. This built-in debugger lets you debug your front-end JavaScript code line-by-line and see console.log () statements directly from Visual Studio Code. For more information, see Browser debugging in VS Code.
This configuration seems to work for me now. It breaks on the breakpoint and shows it as available.
{
"name": "Edge",
"type": "edge",
"request": "launch",
"url": "http://localhost:4200/#",
"webRoot": "${workspaceFolder}",
"sourceMaps": true,
"trace": true,
"userDataDir": "${workspaceRoot}/.vscode/edge"
}
I guess they made some fixes.
The following does hit the breakpoint, but they do show up as unverified in vscode (open circle). I think this might have to do with inline source maps.
{
"version": "0.2.0",
"configurations": [
{
"name": "debug chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:4200/#",
"webRoot": "${workspaceFolder}",
"sourceMapPathOverrides": {
"webpack:/./*": "${webRoot}/*",
"webpack:/src/*": "${webRoot}/src/*",
"webpack:/*": "*",
"webpack:/./~/*": "${webRoot}/node_modules/*"
}
},
{
"name": "debug edge",
"type": "edge",
"request": "launch",
"url": "http://localhost:4200/#",
"webRoot": "${workspaceFolder}",
"sourceMapPathOverrides": {
"webpack:/./*": "${webRoot}/*",
"webpack:/src/*": "${webRoot}/src/*",
"webpack:/*": "*",
"webpack:/./~/*": "${webRoot}/node_modules/*"
},
},
{
"name": "ng test",
"type": "chrome",
"request": "launch",
"url": "http://localhost:9876/debug.html",
"webRoot": "${workspaceFolder}"
},
{
"name": "ng e2e",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/protractor/bin/protractor",
"protocol": "inspector",
"args": ["${workspaceFolder}/protractor.conf.js"]
}
]
}
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