Friday, May 3, 2013

Closure Compiler Breaks eval("$wnd.…")

Hi,

We recently tried to use the closure compiler to reduce file size and ran into an issue where the script would throw a reference error when loading the page. After some digging, I found that one of the Google Maps widgets (v2 for now) uses JSOpaque based enums, which use eval("$wnd.NAME") to get their values. When using the closure compiler (with -XenableClosureCompiler) (0,eval)("$wnd.NAME") is used instead, which uses global scope and so cannot find $wnd. I tried running the output of a regular GWT compile through the just the closure compiler and it did not change the eval statements. I set $wnd.$wnd=$wnd in onModuleLoad for now as a workaround but I'm wondering if there's a better way. Is there a way to configure how the compiler handles eval?

Thanks,

David

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" 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 http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment