You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Show TypeScript line numbers in stack traces #2417
Currently stack traces show JavaScript line numbers instead of TypeScript line numbers. This makes debugging difficult, and it’s also a tricky thing for beginners to understand. I’m adding a debugging section to the Getting Started Guide, and I’m having a heck of a time trying to explain how this works to new users.
You can recreate this by starting a new project that uses TypeScript.
tns create Whatever --ng
cd Whatever
tns run ios --emulator --watch
And then doing something silly like this in your TypeScript code.
throwError("Boom!");
You‘ll see a stack trace that gives line numbers in the compiled JavaScript code, and not the source TypeScript files.
I started to take a look at this by seeing if we could introduce a package like source-map-support to accomplish this, but since we're dealing with an embedded V8 runtime, it immediately blows up trying to import the path module. Perhaps a possible approach would be to replicate the implementation of that package and utilize NS's file system abstractions to read the source maps? Curious to see if anyone else has started looking into the best approach for this.
@dcarrot2 actually source-map-support works perfectly fine on Android/v8. It is actually made for it.
It won't work however with the iOS runtime.See that issue NativeScript/ios-jsc#1135
Here is an example of reading external source map in android {N} app:
Activity
dcarrot2 commentedon Oct 15, 2018
I started to take a look at this by seeing if we could introduce a package like source-map-support to accomplish this, but since we're dealing with an embedded V8 runtime, it immediately blows up trying to import the
pathmodule. Perhaps a possible approach would be to replicate the implementation of that package and utilize NS's file system abstractions to read the source maps? Curious to see if anyone else has started looking into the best approach for this.stevenspiel commentedon Jan 18, 2019
This would be very helpful!
farfromrefug commentedon May 23, 2019
@dcarrot2 actually
source-map-supportworks perfectly fine on Android/v8. It is actually made for it.It won't work however with the iOS runtime.See that issue NativeScript/ios-jsc#1135
Here is an example of reading external source map in android {N} app: