Some of them will depend on the loading order of your scripts. Is jQuery loading up to require.js or vice versa?
The last few lines of jQuery may contain the key to the solution:
if ( typeof define === "function" && define.amd && define.amd.jQuery ) { define( "jquery", [], function () { return jQuery; } ); }
I assume you are doing something like:
var $ = require('jquery'); //lower-case Q
personally, I did:
var $ = require('jQuery'); //upper-case Q
all of this may depend on your require.config - I use something like:
require.config({ baseUrl: "/js", paths : { jQuery: 'lib/jquery-1.7.1.min' //, etc... } })
Another thing to think about: you may not want jQuery to be included as part of your optimized output — instead, download a pre-modified version from the CDN (etc.). In this case, you need to exclude the jquery module as described here: http://requirejs.org/docs/jquery.html
modules: [ { name: "main", exclude: ["jquery"] } ]
source share