Monday, 16 August 2021

How to add sourcemaps to GraalVM JS inspection?

The following code executes a javascript code snippet on GraalVM Javascript engine:

 try (Context context = Context.newBuilder("js").option("inspect", "4444").build()) {
        Value hello = context.eval(Source.newBuilder("js", "some minified javascript", "sample.js").build());

      // E.g.: Sleep a bit so I can open the debugger in chrome and start debugging
} catch (IOException e) {
  e.printStackTrace();
}

How can I attach a sourcemap to this minified javascript?

I tried to add the following to the end of the minified javascript, but port 8080 was not even pinged:

//# sourceMapping=http://localhost:8080/sample.map

Also, if I right click on the developer window and choose Add source map..., the URL I enter is not downloaded (I checked it by implementing a sample servlet on that port that logs every network request).



from How to add sourcemaps to GraalVM JS inspection?

No comments:

Post a Comment