question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Debug component in vs code - source map problem

See original GitHub issue

OS?

Windows 10 64bit

Versions

@angular/cli: 1.0.0-beta.30 node: 6.9.5 os: win32 x64 @angular/common: 2.4.6 @angular/compiler: 2.4.6 @angular/core: 2.4.6 @angular/forms: 2.4.6 @angular/http: 2.4.6 @angular/platform-browser: 2.4.6 @angular/platform-browser-dynamic: 2.4.6 @angular/router: 3.4.6 @angular/cli: 1.0.0-beta.30 @angular/compiler-cli: 2.4.6

Repro steps.

vs code chrome debugging extensions is installed create new project via ng new add to launch.json in vscode:

{
            "name": "Attach Chrome to localhost, with sourcemaps",
            "type": "chrome",
            "request": "attach",
            "port": 9222,
            "url": "http://localhost:4200/",
            "sourceMaps": true,
            "webRoot": "${workspaceRoot}",
             "sourceMapPathOverrides": {
                 "webpack:///C:*":"C:/*"
 }

ng serve attach debugger in vs code

debugging console works in vs code so that I think chrome is attached to vs code right.

but when settings a breakpoint in app.component.ts line 9 vs code says 'Breakpoint ignored because generated code could not be found (source map problem?)

What am I doing wrong?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

11reactions
badre429commented, Feb 9, 2017

debug angular-cli application in google chrome with vscode

i use @angular/cli@1.0.0-beta.30

  1. install Debbuger For Chrome extention in vscode

  2. Close all instances of chrome and run command line

> <path to chrome>/chrome.exe --remote-debugging-port=9222

C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --remote-debugging-port=9222 on windows 3. run ng serve with source map option

 ng serve --sourcemap
  1. change ./.vscode/launch.json to
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Launch Chrome against localhost, with sourcemaps",
      "type": "chrome",
      "request": "launch",
      "url": "http://localhost:4200",
      "sourceMaps": true,
      "webRoot": "${workspaceRoot}",

      "sourceMapPathOverrides": {
      
        "webpack:///./*":"${workspaceRoot}/*" 
      }
    } 
  ]
}
  1. run debug in vscode

you can check the source Map Path Overrides value “webpack:///./*” inside chrome source tab and navigate to you “app.module.ts” file

0reactions
angular-automatic-lock-bot[bot]commented, Sep 7, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript debugging with Visual Studio Code
TypeScript debugging supports JavaScript source maps. To generate source maps for your TypeScript files, compile with the --sourcemap option or set the ...
Read more >
VS Code: "Breakpoint ignored because generated code not ...
I solved my problem by changing .vscode/launch.json so that "sourceMaps": true attribute under the Launch configuration was set (it starts ...
Read more >
Solve “Breakpoint ignored” with Visual Studio code (vscode ...
Breakpoint ignored because generated code not found (source map problem?). You'll have to make sure that your generated source map points to the ......
Read more >
Microsoft/vscode-chrome-debug - Gitter
I am having a hair-pulling time attempting to map a folder (containing code common to all projects) which sits outside of my main...
Read more >
Advanced Features: Debugging - Next.js
Debug your Next.js app. ... React Server Components ... and backend code with full source maps support using either the VS Code debugger...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found