user2909133
user2909133

Reputation:

Does the GWT Compiler reduce unused JavaScript Code of an external Library?

With GWT I can use JSNI to include external libraries like JQuery.

If I use an external library with JSNI what does the GWT compiler do?

  1. Does it include the hole full size JavaScript library?

  2. Does it include only the code of the library that have been used?

Upvotes: 2

Views: 159

Answers (1)

Thomas Broyer
Thomas Broyer

Reputation: 64561

Assuming you copied the whole jQuery script into a JSNI method (ouch!), then GWT will do its best to optimize it, including pruning dead code. Results would really depend on the JS code though, not everything can be statically analyzed to determine what code will or won't be used.

Upvotes: 2

Related Questions