Tuesday, December 22, 2015

Re: Compile a Java application into a single JavaScript file?

Ah, OK.
The solution is a custom linker then; I don't think there's any built-in linker that would do that.
Use the CrossSiteIframeLinker as a base and customize from there; see shouldIncludeBootstrapInPrimaryFragment. Apparently it shouldn't be much work. IIUC, you'd then get a <md5>.cache.js that can be loaded directly. The generated compilation-mappings.txt would tell you the name of that file. AFAIK that's what Google uses (known as SSSS == Server-Side Selection Script), except several permutations are generated and (based on the compilation-mappings.txt) the right <md5>.cache.js is selected on the server side depending on the user.agent making the request (and the locale, from the current request or the logged-in user's profile). If you have a single permutation, then things are a bit easier ;-)

On Tuesday, December 22, 2015 at 1:57:16 AM UTC+1, Michael Zhou wrote:
That site runs on a GWT app built from Google's internal Bazel BUILD rules, not from the open-source Maven pom-gwt.xml...

On Sunday, December 20, 2015 at 8:13:24 AM UTC+8, Thomas Broyer wrote:

On Saturday, December 19, 2015 at 5:09:23 PM UTC+1, Michael Zhou wrote:
Well there's a <module>.nocache.js and an <md5>.cache.js file. Ideally I want to have a single .js file that I can load from any .html file.

But when I go to https://closure-compiler-debugger.appspot.com/gwt_debugger.html only the <module>.nocache.js is loaded, so it's already working as intended.
Not sure why a <md5>.cache.js is generated, but apparently it can be ignored.

On Sunday, December 13, 2015 at 11:19:54 PM UTC+8, Thomas Broyer wrote:

On Sunday, December 13, 2015 at 2:58:21 AM UTC+1, Michael Zhou wrote:
I have used GWT to compile a Java application (Google's Closure Compiler) into a GWT application.
Currently, GWT outputs a .cache.js file and a .nocache.js file. I wonder if it's possible to output a single .js file instead of two?
We might switch to J2CL when it's ready, but just in case it's possible to do so with GWT 2.8.

Not sure what you're talking about exactly, but at runtime only one file is loaded.
Is the other file named devmode.nocache.js maybe?

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