Debugging GWT app in production by loading SourceMaps from local environment

1k views Asked by At

I'd like to debug a GWT 2.7 based app using sourcemaps in Chrome. However, I don't want all sources to be included in the shipped WAR file. I managed to generate sourcemaps during Maven build using saveSource compiler setting. Question now is, how can a "attach" sourcemaps to a running system from within the Browser.

I already have the sourcemap json file served by a local server and was also able to load sources from there by using context menu of the generated GWT js file: enter image description here

This shows the java package hierarchy on the left - cool! However, break points in java files don't work and the source map entries disappear again on page reload, which means I would not be able to debug any initialization logic.

Any ideas?

1

There are 1 answers

2
Albert Scholtz On

Starting a new project, in my gwt module, I added the following lines of code:

<set-property name="compiler.useSourceMaps" value="true"/>
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
<set-configuration-property name="CssResource.obfuscationPrefix" value="empty"/>

Starting the dev server in super dev mode after this allowed me to view my java code and also debug in all classes, including the entry point class. When a java breakpoint is set in the entry point class (I am using chrome 43.0.2357.81 m at this moment) I am able to refresh the page and the breakpoint is hit again.

Hope this helps!