Thursday, May 12, 2016

Re: Sourcemaps with sso linker



On Thursday, May 12, 2016 at 3:42:36 AM UTC+2, Dmitry Skavish wrote:
hi everybody,

I could not figure out how do I build my app and generate sourcemap
url into js file along with all the sources. Anybody can shed some
light here?

That's what I did:

1. I added <set-property name="compiler.useSourceMaps" value="true"/>
to my module and now I have sourcemaps generated.

2. Now if I want to use it I need to manually add the path to the map
to my generated js file, something like that:

//# sourceMappingURL=../WEB-INF/deploy/playerDebug/symbolMaps/AE31C96E973F2818434AA5B24477E385_sourceMap0.json

3. Adding the path gives me the mapping to java classes, but since
there is no sources available it's kind of useless. How do I specify
path to the sources? Is there anyway I can add it to js file?

Is there anyway to automate step 2?

Yes; the GWT website does that for instance.
You have to add something like the following to your gwt.xml:
<set-configuration-property name="includeSourceMapUrl" 
     value="http://www.gwtproject.org/src/__HASH___sourceMap__FRAGMENT__.json"/>

__HASH__ and __FRAGMENT__ will be replaced with the appropriate values.

You may also want to pass -saveSource to the GWT compiler so it dumps on disk the source files it used (including those produced by GWT generators during the compilation).

For reference, the commit that added sourcemaps for gwtproject.org: https://gwt.googlesource.com/gwt-site-webapp/+/423256d63e17eb9e117c61d2ba6ad4adbf32b15f%5E%21/
 
Note that I am just opening the module's html in browser as local
file, not via webserver.

I'm afraid some things won't work in this setup (I can't tell if it'll change anything to source maps though); try to use a web server (even if only a "python -m SimpleHTTPServer")

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment