Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Incorrect line numbers of the source files. #1319

Closed
amreladawy opened this issue Nov 20, 2017 · 18 comments
Closed

Incorrect line numbers of the source files. #1319

amreladawy opened this issue Nov 20, 2017 · 18 comments

Comments

@amreladawy
Copy link

Short description of the problem:

Some of the components are mapped to wrong line numbers. That is making dubbing on chrome very difficult.

Some of the classes are correctly mapped to original line numbers, some are not. There is always a shift but in a variable number of lines.

What behavior are you expecting?

The source mapped files should match the original *.ts files.

Which @ionic/app-scripts version are you using?
@ionic/cli-utils : 1.18.0
ionic (Ionic CLI) : 3.18.0

global packages:

cordova (Cordova CLI) : not installed

local packages:

@ionic/app-scripts : 3.1.0
Cordova Platforms  : browser 4.1.0 ios 4.5.1
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node              : v6.11.2
npm               : 5.5.1
OS                : Windows 10

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)

There was a reported issue on angular that is closed.
angular/angular-cli#2811

@danbucholtz
Copy link
Contributor

Can you provide a sample project to reproduce the issue?

Thanks,
Dan

@amreladawy
Copy link
Author

amreladawy commented Nov 20, 2017

Hi Dan,
Thanks for the prompt response. here is what I tried.

ionic start test tabs
cd test
ionic g page test

Then edit the test.ts as following:

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';

/**
 * Generated class for the TestPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage({
  name: "test",
  segment: "test"
}) @Component({
  selector: 'page-test',
  templateUrl: 'test.html',
})
export class TestPage {

  constructor(public navCtrl: NavController, public navParams: NavParams) {
  }


  ionViewDidLoad() {
    console.log('ionViewDidLoad TestPage');
    console.log("Line26")
    console.log("Line27")
    console.log("Line28")
    console.log("Line29")
    console.log("Line30")


    console.log("Line33")
    console.log("Line34")
    console.log("Line35")
    console.log("Line36")


    console.log("Line39")
    console.log("Line40")
    console.log("Line41")
    console.log("Line42")

  }

}

The log statements match the line number in the test.ts file.

running the app will show the following

image

Inspecting the source code shows the following

image

Please note that the line number showed next to the statement is correct, however, if you set a breakpoint next to line 26, for example, it is in fact at line 29 where lines 26,27,28 are executed before hitting the breakpoint.

You may also notice how the line numbers on the side of the source files are active and inactive according to a shifted basis.

@thedang
Copy link

thedang commented Nov 20, 2017

Can you try, add lines in file package.json

"config": {
    "ionic_bundler": "webpack",
    "ionic_source_map_type": "eval"
  }

@amreladawy
Copy link
Author

amreladawy commented Nov 20, 2017

Hi,
I tried what you suggested, and the src folder disappeared from chrome. also, lines are shifted by two lines .

image

@keyz182
Copy link

keyz182 commented Dec 14, 2017

I'm also seeing the same behaviour as @amreladawy

@danbucholtz
Copy link
Contributor

This is fixed in the 3.1.5 release.

Thanks,
Dan

@amreladawy
Copy link
Author

amreladawy commented Dec 15, 2017

Here is the change

a5df139

@amreladawy
Copy link
Author

Hi Dan,

I still see this issue again on my current project event after updating to latest app-scripts. It is not happening when starting a new project.

@amreladawy
Copy link
Author

amreladawy commented Jan 25, 2018

Hi Dan,
I still have the same issue. Should I do anything?

@amjadyahya
Copy link

same here with ionic 3.19.1

@snortblt
Copy link

Also seeing with ionic 3.9.2

@marcellkiss
Copy link

marcellkiss commented May 2, 2018

No success after updating to the latest version:
ionic/app-scripts: 3.1.9
Debugging is unusable :(

@mydoal
Copy link

mydoal commented May 21, 2018

Using action script 3.1.8
Ionic 3.19.1

This issue still persists.
There is a difference of two lines in the Chrome debugger.
All imports are done in the same line (no breaking up imports across several lines).

Why is this issue closed?
Did someone find a solution?

@exequielc
Copy link

same issue here. There is any help ?

@pcsantana
Copy link

Hi!
I was facing the same problem.
To solve this issue make sure that:

1. Imports are defined in one line! Example:

Do:

import { ChangeDetectorRef, Component, Injector, ViewChild, ElementRef } from '@angular/core';

Avoid:

import { 
	ChangeDetectorRef, 
	Component, 
	Injector, 
	ViewChild, 
	ElementRef 
} from '@angular/core';

2. @IonicPage decorator is defined in one line:

Do:

@IonicPage({name: 'TestPage', segment: 'test-page'})

Avoid:

@IonicPage({
    name: 'TestPage,
    segment: 'test-page'
})

Why? I don´t know, but worked for me! :D

@keyz182
Copy link

keyz182 commented Jun 29, 2018

@pcsantana I guess I'm disabling "max-line-length" in tslint then if this works!

@synnottd
Copy link

I'm experiencing this on 3.2.0. Is there any fix for this apart from moving imports and decorators onto one line?

@leegee
Copy link

leegee commented Oct 22, 2018

Same issue in "@ionic/angular": "4.0.0-beta.12" -- presumably using faulty webpack source mapper, but I have no idea where that is configured....

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests