Skip to content

Incorrect line numbers in sourcemaps #2811

Closed
@dballance

Description

@dballance

OS?

Windows 10

Versions.

angular-cli: 1.0.0-beta.18
node: 6.5.0
os: win32 x64

Checked a beta.17 project, does not appear to occur there. Lines seem to be correct for debugging.

Repro steps.

  • ng new source-map
  • cd source-map
  • ng serve
  • Open src/app/app.component.ts and add some testing code
export class AppComponent {
  title = 'app works!';

  ngOnInit(){
    let value = true;
    if (value){
      value = false;
    }
  }
}

  • Open devtools (tested in Chrome)
  • ctrl+p and open app.component.ts
  • Set breakpoint on line 12 (let value = true) and line 14 (value = false)
  • Refresh page
  • Hit breakpoint on line 12, notice call stack is outside ngOnInit even though breakpoint is within
  • Hit breakpoint on line 14, notice call stack is within ngOnInit but value = undefined
  • Step and see code execute as expected, but highlighted line to be shifted by a few lines

Other useful info

Seems to shift by ~ 5 lines in my local project, not sure if it is the same shift in the repro (repro shift looks like 3?). Shift can be seen in VS Code Chrome Debugging - where line numbers are given for the mappings.

Maps 48991 (actual line in main.bundle.js that breakpoint is set to in vscode) to 48986 (where the breakpoint actually is during runtime)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions