I am using requireJS for the first time. I got it working fine then came to optimize the files to minify and concatenate and now I get the error "Uncaught TypeError: undefined is not a function" the error is on line 8175 of front-built.js. I have left the file unminifed for this question to make it easier to identify the problem.
My main JS file before optimization looks like this (works fine): .js
And after optimization (throws the error on line 8175): .js
Hope someone is more familier with requireJS than me and can fix this issue. Is may be the way I'm including my JS file before optimization. I'm really not sure.
I am using requireJS for the first time. I got it working fine then came to optimize the files to minify and concatenate and now I get the error "Uncaught TypeError: undefined is not a function" the error is on line 8175 of front-built.js. I have left the file unminifed for this question to make it easier to identify the problem.
My main JS file before optimization looks like this (works fine): http://thebeer.co/js/front.js
And after optimization (throws the error on line 8175): http://thebeer.co/js/front-built.js
Hope someone is more familier with requireJS than me and can fix this issue. Is may be the way I'm including my JS file before optimization. I'm really not sure.
Share Improve this question asked Mar 2, 2011 at 16:09 wilsonpagewilsonpage 17.6k23 gold badges105 silver badges150 bronze badges1 Answer
Reset to default 5I see the problem there:
define('globals',["jquery"],(function($){
var siteWrap = $('#siteWrap'),
membersTab = $('#membersTab'),
mID = siteWrap.attr('mID');
if(window.location.host == "dev.thebeer.co"){
var staticURL = "http://static.thebeer.co";
}else{
var staticURL = "https://static.meshmesh.us";
}
// ... SNIP SNIP ....
})());
You're not passing jQuery
to the anonymous function, therefore $
is undefined
inside the function. That last line should be like this:
})(jQuery));
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745051720a4608429.html
评论列表(0条)