jQuery 1.7 registers itself as an AMD module by the name of 'jquery', so you need to create a mapping for 'jquery' using the paths config:
requirejs.config({
paths: {
'jquery' : 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min'
}
});
require(['jquery'], function($) {
//$ points to jQuery
});
Note however that RequireJS loads modules asynchronously and out of order, so if you have jQuery plugins you want to use that are not wrapped in define(['jquery'], function ($){ /* plugin code goes here */ });
calls, the plugin could execute before jQuery is loaded.
See the require-jquery project's README on ways to deal with files that depend on jQuery but do not wrap themselves in define()
calls.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…