Skip to content

Sourcemaps for angular-ui-router bower components and npm modules are broken #3465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aeisenberg opened this issue Jun 12, 2017 · 4 comments
Closed

Comments

@aeisenberg
Copy link

  • [x ] Bug Report

My version of UI-Router is: 1.0.3

Bug Report

Current Behavior:

Cannot set breakpoints in any ui-router files in Chrome Dev Tools. Cannot step through any ui-router files in Chrome Dev Tools.

Steps to reproduce:

  1. Create a project that imports ui-router 1.0.3
  2. Open a page from that project in chrome
  3. Open debugger.
  4. Open bower_components/angular-ui-router/release/angular-ui-router.js (or any other file in the ui-router project)
  5. Set a breakpoint.
  6. BUG: Chrome navigates you a non-existant typescript file (though breakpoint is set)
  7. Run program to that point
  8. BUG: Chrome stops the debugger at the appropriate line in the program, but opens a blank typescript file.

There are other problems related to this bug, including the inability to run karma tests that rely on sourcemaps.

Analysis

The sourcemaps appear to be broken. Open up the file releases/angular-ui-router.js.map and you can see that it references a bunch of sources, like this:

"sources":["../src/angular.ts","../node_modules/@uirouter/core/src/common/hof.ts","../node_modules/@uirouter/core/src/common/glob.ts","...

None of these files exist in the bower component.

The solution I would suggest would be to ensure that typescript files are included in the bower component.

@aeisenberg
Copy link
Author

aeisenberg commented Jun 12, 2017

Hmmm...I am now taking a look at the npm packages in the @uirouter namespace. They don't appear to have typescript sources either. So, I would guess that things are broken for these packages as well.

@aeisenberg
Copy link
Author

And looking a bit deeper into the source maps, I see entries like the following: /Users/cthielen/projects/uirouter/angularjs/node_modules/@uirouter/core/src/common/predicates.ts.

So, it looks like there are two problems here and the problems are most likely present in both the bower and the npm versions of the package:

  1. source map source files (ie- the *.ts files) do not exist in the package
  2. source map source paths reference fully qualified paths

I am updating the title of this report accordingly.

@aeisenberg aeisenberg changed the title Sourcemaps for angular-ui bower components are broken Sourcemaps for angular-ui-router bower components and npm modules are broken Jun 12, 2017
@aeisenberg
Copy link
Author

I can submit a PR for this. It is easy enough to ensure that *.ts files are included in npm and bower builds, but I am not sure how rollup generates its sourcemaps. So, I don't know how to fix full paths in sources files.

If someone could give me a pointer, I would submit a fix for this. Thanks.

aeisenberg added a commit to aeisenberg/ui-router that referenced this issue Jun 12, 2017
In order to create correct sourcemaps, all target sources
must be available at generation time. Additionally, when
the browser loads source maps, they must be available
to the browser at the specified path.

This fix ensures that *.ts files are shipped in the
npm package and bower component.

Fixes angular-ui#3465.
aeisenberg added a commit to aeisenberg/core that referenced this issue Jun 12, 2017
In order to create correct sourcemaps, all target sources
must be available at generation time. Additionally, when
the browser loads source maps, they must be available
to the browser at the specified path.

This fix ensures that *.ts files are shipped in the
npm package and bower component.

Fixes angular-ui/ui-router#3465.
@aeisenberg
Copy link
Author

I think the PRs I submitted above are enough to fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant