We have a very large GWT project that results in a monolithic app about 2Mb in size. The obvious way to break it up is to use split points. For example our app is menu driven so the logic behind each menu action could be a split point. Also, the code that invokes GWT RPC could also be a split point. In this way a 2Mb app could probably be broken down into a 300K startup app with the remainder loaded up on first use.
GWT treats calls to GWT.runAsync() as places where the JS can be broken up into smaller pieces which are loaded asynchronously at runtime. e.g. to set a split point where doSomething() is invoked, we write it like this:
GWT.runAsync(new RunAsyncCallback() {
public void onFailure(Throwable caught) {
Window.alert("Oh dear could not load app");
}
public void onSuccess() {
doSomething();
}
});
GWT compiler will see this code and mark it as a candidate for splitting and break up the code into smaller fragments which will be loaded as they are first used.
The problem we have is that if we put split points into the code, the build literally takes 10-50x longer to perform. I guess the code is not very efficient when dealing with a project containing a very large number of classes. So a 2 minute build becomes a 20-100 minute build which is unacceptable.
So the question is, how can I put split points into the code but prevent the compiler from splitting unless I explicitly ask for it? I envisage that day to day development will ignore the split points, but a nightly or production build would split.
Any ideas?