I keep getting errors that the function (renamed) does not exist for the given object. Is there a release or setting or something to make it work?
You have to declare jQuery as an extern to the compiler...however I'm not sure if anyone's made one, there was an extern file for 1.3.2, but I haven't seen any 1.4+ versions.
Edit: this issue thread here has the community building a 1.4 version.
You must use an externs file for jQuery when using Closure Compiler Advanced Mode with jQuery. Extern file will tell compiler these are reserved methods and accept these argument and argument data types should be like that, so do not minify method names and check argument data types in that way.
You can get externs file which is created by Google Developers here. This file generated for jQuery-1.4.3. But currently probably will work any version of jQuery. Newly added methods may not include in that file, so you should add it to externs file, syntax and synonyms are so simple.
Also you can say location of externs file to compiler by using an extra compier flag. Syntax should be like this
--compiler_flags= "--externs=path/to/jquery.externs.js"
Also you can use this tool which is an online externs extractor for Closure Library.
jQuery is not compatible (yet) with the Closure Compiler in advanced mode. I agree it would be a very good thing to make it compatible, because its method-chaining syntax lends very readily to prototype virtualization for much improved execution speed.
In fact, among the popular JavaScript libraries (other than Closure Library, that is), only the Dojo Toolkit is compatible with Closure Advanced mode.
来源:https://stackoverflow.com/questions/4017469/is-it-possible-to-use-closure-compiler-advanced-optimizations-with-jquery