I’ve initialized a blank angular project with ng new
and configured the launch.json in visual studio code with default chrome launch
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost-app.myapp.com:4200",
"webRoot": "${workspaceFolder}"
}
]
I’ve mapped in my host file 127.0.0.1 to this custom url and modified in package.json
the start script with
"start": "ng serve --disable-host-check",
application work calling custom URL but VSC debugger does not bind breakpoints.
If I set localhost
in launch.json and remove --disable-host-check
, debugger works as usual launched on localhost.
Is there any way to make VSC debugger work on localhost-app.myapp.com
my custom host?
2
Answers
If it helps, I solve my problem removing vs code proxy configuration.
Proxy blocks source map discovery and does not load sourcemaps.
So, check your proxy conf if you have one
The launch.json file should look like this, with values changed to reflect your environment:
You can reffer to more info here:
https://automationpanda.com/2018/01/12/debugging-angular-apps-through-visual-studio-code/