Reputation: 1715
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).
Upvotes: 9
Views: 10816
Reputation: 890
Based on other answers this is step by step how I made it work on my machine:
launch.json
in .vscode folder with following contents:{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Edge",
"request": "launch",
"type": "msedge",
"url": "https://localhost:4200",
"webRoot": "C:\\Source\\MyApp\\Front", // You can use ${workspaceFolder}
"version": "dev"
},
{
"name": "Attach to Edge",
"request": "attach",
"type": "msedge",
"port": 9222,
"urlFilter": "https://localhost:4200/*", // attach only to angular urls
"webRoot": "C:\\Source\\MyApp\\Front",
}
]
}
--remote-debugging-port=9222
as parameter to edge shortcut property TargetAnd that's it, it will work as expected.
Be careful if you use ${workspaceFolder}
in your configuration, then it means that you need to open a folder in your vscode at C:\Source\MyApp\Front
folder, instead of C:\Source\MyApp\Front\scr
location.
Upvotes: 1
Reputation: 1992
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.
Upvotes: 4
Reputation: 764
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"]
}
]
}
Upvotes: 1