I just checked out the sample project and changed the app.build.js
optimize property to "closure". I then went to the webapp/scripts
directory and ran ..\..\requirejs\build\buildj.bat app.build.js and I
get the following error (in the "Tracing dependencies for : jquery"
phase):
However, it works if I set the optimize property to "uglify" or
comment it out (which should of course be tthe same thing).
Debugging through the optimize.js file, I noticed that
JSSourceFilefromCode is undefined, so return
JSSourceFilefromCode.invoke(null, [filename, content]); fails. It
also appears that the call to initialize JSSourceFilefromCode -
java.lang.Class.forName('com.google.javascript.jscomp.JSSourceFile').getMet hod('fromCode',
[java.lang.String, java.lang.String]); throws a
java.lang.ClassNotFoundException.
However it appears that JSSourceFile is in the closure.jar and appears
to be the same number of bytes as the one in my older version of
require, telling me that it probably did not change. Anyway, has
anyone else run into this, and if so, does anyone have any ideas on
what the root cause might be?
Also, I forgot to mention, I am running on Windows XP (and don't say
"well there is the problem right there" - I have already heard that :)
with Java 1.6.
On Feb 21, 3:10 pm, Billy <mattmwhee...@gmail.com> wrote:
> I just checked out the sample project and changed the app.build.js
> optimize property to "closure". I then went to the webapp/scripts
> directory and ran ..\..\requirejs\build\buildj.bat app.build.js and I
> get the following error (in the "Tracing dependencies for : jquery"
> phase):
> However, it works if I set the optimize property to "uglify" or
> comment it out (which should of course be tthe same thing).
> Debugging through the optimize.js file, I noticed that
> JSSourceFilefromCode is undefined, so return
> JSSourceFilefromCode.invoke(null, [filename, content]); fails. It
> also appears that the call to initialize JSSourceFilefromCode -
> java.lang.Class.forName('com.google.javascript.jscomp.JSSourceFile').getMet hod('fromCode',
> [java.lang.String, java.lang.String]); throws a
> java.lang.ClassNotFoundException.
> However it appears that JSSourceFile is in the closure.jar and appears
> to be the same number of bytes as the one in my older version of
> require, telling me that it probably did not change. Anyway, has
> anyone else run into this, and if so, does anyone have any ideas on
> what the root cause might be?
On Mon, Feb 21, 2011 at 2:10 PM, Billy <mattmwhee...@gmail.com> wrote: > I just checked out the sample project and changed the app.build.js > optimize property to "closure". I then went to the webapp/scripts > directory and ran ..\..\requirejs\build\buildj.bat app.build.js and I > get the following error (in the "Tracing dependencies for : jquery" > phase):
Thanks for the report! There is definitely a bug. I did some Windows testing before release, but unfortunately it was with no optimization or with uglify. I am not passing the closure.jar in the batch scripts, and it looks like there is a logger error too. I'll work on a fix, I plan on getting it done tomorrow (may be tomorrow evening, Pacific time).
> I uploaded a new zip of the jquery sample project with this change, it
> is available here (will go away at some point, probably after the 0.24
> release):http://requirejs.org/temp/jquery-require-sample.zip
> Thank you very much for the error report. It turns out I broke closure
> minifying on all systems. This change fixes it for all systems.
I am seeing the same error "TypeError: Cannot call method "invoke" of undefined" when changing the *optimize* option to *closure. *It works fine with the default option which I believe is using "UglifyJS"? Correct me if I am wrong.
I am using requiresjs 2.0.2 with r.js from jquery-requirejs sample project.
On Monday, February 21, 2011 2:10:19 PM UTC-8, Billy wrote:
> I just checked out the sample project and changed the app.build.js > optimize property to "closure". I then went to the webapp/scripts > directory and ran ..\..\requirejs\build\buildj.bat app.build.js and I > get the following error (in the "Tracing dependencies for : jquery" > phase):
> However, it works if I set the optimize property to "uglify" or > comment it out (which should of course be tthe same thing).
> Debugging through the optimize.js file, I noticed that > JSSourceFilefromCode is undefined, so return > JSSourceFilefromCode.invoke(null, [filename, content]); fails. It > also appears that the call to initialize JSSourceFilefromCode - > java.lang.Class.forName('com.google.javascript.jscomp.JSSourceFile').getMet hod('fromCode',
> [java.lang.String, java.lang.String]); throws a > java.lang.ClassNotFoundException.
> However it appears that JSSourceFile is in the closure.jar and appears > to be the same number of bytes as the one in my older version of > require, telling me that it probably did not change. Anyway, has > anyone else run into this, and if so, does anyone have any ideas on > what the root cause might be?
Hmm, I just tried this too in the require-jquery project, and got a
similar error. I wonder if I need to update the interface I use to
closure compiler. I filed this bug to track a fix for 2.0.5:
On Mon, Jul 23, 2012 at 11:32 AM, Chintan Desai <cd.chin...@gmail.com> wrote:
> I am seeing the same error "TypeError: Cannot call method "invoke" of
> undefined" when changing the optimize option to closure. It works fine with
> the default option which I believe is using "UglifyJS"? Correct me if I am
> wrong.
> I am using requiresjs 2.0.2 with r.js from jquery-requirejs sample project.
> Please advise
> Thanks
> On Monday, February 21, 2011 2:10:19 PM UTC-8, Billy wrote:
>> I just checked out the sample project and changed the app.build.js
>> optimize property to "closure". I then went to the webapp/scripts
>> directory and ran ..\..\requirejs\build\buildj.bat app.build.js and I
>> get the following error (in the "Tracing dependencies for : jquery"
>> phase):
>> However, it works if I set the optimize property to "uglify" or
>> comment it out (which should of course be tthe same thing).
>> Debugging through the optimize.js file, I noticed that
>> JSSourceFilefromCode is undefined, so return
>> JSSourceFilefromCode.invoke(null, [filename, content]); fails. It
>> also appears that the call to initialize JSSourceFilefromCode -
>> java.lang.Class.forName('com.google.javascript.jscomp.JSSourceFile').getMet hod('fromCode',
>> [java.lang.String, java.lang.String]); throws a
>> java.lang.ClassNotFoundException.
>> However it appears that JSSourceFile is in the closure.jar and appears
>> to be the same number of bytes as the one in my older version of
>> require, telling me that it probably did not change. Anyway, has
>> anyone else run into this, and if so, does anyone have any ideas on
>> what the root cause might be?
I used the compiler.jar included in the project and also the latest jar from closure project which was " compiler-20120710.zip". I updated the bug with this information too.
I am little confused about the workaround that you mentioned. Do you mean I should run r.js with default optimize option first and then do the same by running closure compiler?
On Tuesday, July 24, 2012 4:57:20 PM UTC-7, James Burke wrote:
> Hmm, I just tried this too in the require-jquery project, and got a > similar error. I wonder if I need to update the interface I use to > closure compiler. I filed this bug to track a fix for 2.0.5:
> Feel free to add any more details to that bug, or even just the > version of closure compiler in use. I'm wondering if the interface > changed.
> A workaround for now would be to run closure compiler separately and > directly, after r.js runs.
> James
> On Mon, Jul 23, 2012 at 11:32 AM, Chintan Desai wrote: > > I am seeing the same error "TypeError: Cannot call method "invoke" of > > undefined" when changing the optimize option to closure. It works fine > with > > the default option which I believe is using "UglifyJS"? Correct me if I > am > > wrong.
> > I am using requiresjs 2.0.2 with r.js from jquery-requirejs sample > project.
> > Please advise
> > Thanks
> > On Monday, February 21, 2011 2:10:19 PM UTC-8, Billy wrote:
> >> I just checked out the sample project and changed the app.build.js > >> optimize property to "closure". I then went to the webapp/scripts > >> directory and ran ..\..\requirejs\build\buildj.bat app.build.js and I > >> get the following error (in the "Tracing dependencies for : jquery" > >> phase):
> >> However, it works if I set the optimize property to "uglify" or > >> comment it out (which should of course be tthe same thing).
> >> Debugging through the optimize.js file, I noticed that > >> JSSourceFilefromCode is undefined, so return > >> JSSourceFilefromCode.invoke(null, [filename, content]); fails. It > >> also appears that the call to initialize JSSourceFilefromCode -
> >> [java.lang.String, java.lang.String]); throws a > >> java.lang.ClassNotFoundException.
> >> However it appears that JSSourceFile is in the closure.jar and appears > >> to be the same number of bytes as the one in my older version of > >> require, telling me that it probably did not change. Anyway, has > >> anyone else run into this, and if so, does anyone have any ideas on > >> what the root cause might be?
On Wed, Jul 25, 2012 at 11:12 PM, Chintan Desai <cd.chin...@gmail.com> wrote:
> I used the compiler.jar included in the project and also the latest jar from
> closure project which was " compiler-20120710.zip". I updated the bug with
> this information too.
Thanks.
> I am little confused about the workaround that you mentioned. Do you mean I
> should run r.js with default optimize option first and then do the same by
> running closure compiler?
Sorry, I meant use optimize: 'none' to skip minification in r.js, then
do the closure compiler pass after r.js completes. Of course if you
are OK with the default minifier, uglifyjs, then you can leave out any
optimize: option in the build options to get that.