Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RequireJS : Problem including jquery easing pack after optimization

I want to include the jquery easing pack into my application. Before requireJS files have been 'optimized' it works fine. Now I am using the optimized version when ever I call an animation that uses easing I get this error:

"jQuery.easing[jQuery.easing.def] is not a function" (firefox)

"Uncaught TypeError: Property 'undefined' of object # is not a function" (chrome)


I include my JS like this:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js"></script>
<script src="http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js"></script>
<script data-main="/js/mesh-built.js" src="/js/libs/require.js"></script>

My main JS page looks like this: http://thebeer.co/js/built/mesh-built.js

require(["globals","functionBank"],function(gb,r){

//myapp code

});

globals looks like this:

http://thebeer.co/js/globals.js


and functionbank looks like this:

http://thebeer.co/js/functionBank.js


My only thought is that becuase jquery is stated as a dependency within globals and functions it is somehow being passed in without the easing pack attached? Should I attach the easing plugin from within the main requireJS file instead?

FORGOT TO MENTION: This problem is only evident once the scripts have been optimised by requireJS...

like image 477
wilsonpage Avatar asked Dec 10 '25 13:12

wilsonpage


1 Answers

The mesh-built.js file seems to include require.js contents. It is best if it does not include require.js (make sure that includeRequire: true is not specified in the build profile. My first thought is this duplicate require is causing the problem, it may not have the correct reference to jQuery and it is being used to handle the built.js file.

like image 126
jrburke Avatar answered Dec 12 '25 03:12

jrburke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!