3
votes

I have an aurelia application updated to the latest beta, 1.0.0-beta.1.2.1 at the time of this writing. This version of aurelia already uses Babel 6, and my application is based on the based on the ASP.NET 5 ES2016 navigation skeleton.

"All of a sudden", whenever I try to open my untranspiled javascript source files in Chrome (Version 49.0.2623.110 m (64-bit)) Developer tools, for instance main.js, all I get to see is the html of Index.cshtml.
It doesn't matter which javascript file I try to open, it always shows the html of Index.cshtml instead of javascript.

The transpiled files are displayed correctly in Chrome Dev Tools.

I've had this before but it usually meant I had a binding or templating error somewhere, but in this case the application works perfectly, so it probably has to do with the sourcemaps... Or does it?

My questions are:

  1. What is the best way to track down a subtle binding or templating error in Aurelia? Everything I've tried to do in my applcation works fine, but I don't want to rule out this being my own fault just yet.

  2. In case it's not my fault, has anybody come across this before? What is the reason the sourcemaps are not working; is it Aurelia? is it Babel 6? Is it Chrome?

Update

It doesn't seem to be a Chrome issue; the same problem occurs in Edge.

Update 2

By turning off Enable javascript sourcemaps on Chrome Developer Tools I can debug de transpiled code. The transpilation gulp tasks I'm using are copy/pasted from the version mentioned above.

Has anybody else come across this issue?

1
Sounds like your web server isn't serving the source properly. Not sure why but the body of the response would probably be more telling.PW Kad
@PWKad good call, I'll try and add the body of the response here.Sergi Papaseit
@PWKad The body of the response is of course the transpiled js file; sorry. It's when I try to open the untranspiled raw source that I get html.Sergi Papaseit

1 Answers

1
votes

Ok, I think I've found the problem.

I changed includeContent to true for sourcemaps.write in the build-system gulp task defined in build\tasks\build.js, so that line 23 of that file looks as follows:

.pipe(sourcemaps.write({ includeContent: true}))

This comes set to false in the navigation skeleton, so more people should have this same issue. Anyhow, this seems to have solved the problem.

I also removed the sourceRoot: "/src" parameter in that call, as it is only necessary when includeContent is false.