Reputation: 17610
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.
Upvotes: 0
Views: 6143
Reputation: 14031
I 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));
Upvotes: 5