graaljs icon indicating copy to clipboard operation
graaljs copied to clipboard

Question: Source maps and debugging support from JDK?

Open pintomau opened this issue 3 years ago • 5 comments

Hi!

Is debugging and source map features only available when using node or is there some way to do any of this using JDK?

Source maps would be useful to us because we're transpiling and bundling from typescript, and of course when an error occurs, the referenced line is currently the bundled one instead of the inlined source map reference.

Thanks!

pintomau avatar Jan 31 '22 20:01 pintomau

This question on stackoverflow.com may cover what you are looking for.

iamstolis avatar Jan 31 '22 21:01 iamstolis

Nevermind. I need the chrome inspector dependency.

Will look into that and come back, thanks.

pintomau avatar Jan 31 '22 21:01 pintomau

OK. I got the debugger working, great! Thanks.

However when an error is thrown from within the script do not add any hinting towards where in the typescript this relates to.

Exception in thread "main" Error: some error
	at <js> map(typescript-bundling/target/classes/js/index.js:601:25551-25569)

Would there be a way to enhance this?

pintomau avatar Jan 31 '22 22:01 pintomau

@pintomau I had this question a while ago. I've ended up by reformating the exception textual content on my logger, replacing the character indexes by, the line and column indexes so later I can plugin the source maps or like you did, just rely on the debugger:

https://github.com/reactiverse/es4x/blob/develop/es4x/src/main/java/io/reactiverse/es4x/jul/ANSIFormatter.java#L181-L275

pmlopes avatar Feb 01 '22 10:02 pmlopes

Thanks for the hints, @pmlopes . Will look into it.

Also noticed VertxFileSystem that seems to allow loading files from within the JAR, as claimed in https://github.com/reactiverse/es4x/blob/98bc57a0210940946652cf15129300a5f9f48322/docs/advanced/commonjs.md#specific-differences. Interesting, as we eventually would also like to be able to load node_modules from within the jar.

pintomau avatar Feb 01 '22 11:02 pintomau