I solved a similar problem (Jquery.cookie) like this, but my problem was that Jquery loaded and then turned on Jquery.cookie, but that already required JQuery as a static resource.
So, I pass jQuery.Cookie to the application and only inserts jquery.cookie into the scope of my application.
require.config({ paths: { 'async' : 'libs/async' ,'jquery' : 'libs/jquery' ,'underscore' : 'libs/underscore' ,'backbone' : 'libs/backbone' ,'text' : 'libs/text' ,'jquery.cookie' : 'libs/jquery.cookie' // <-- cookie lives here } ,shim: { 'jquery': { exports: '$' } ,'underscore': { exports: '_' } ,'backbone': { deps: ['underscore', 'jquery'], exports: 'Backbone' } ,'jquery.cookie': { //<-- cookie depends on Jquery and exports nothing deps: ['jquery'] } } });
and then in the main class of the application I added
require([ 'jquery' ,'underscore' ,'backbone' ,'mapApp' ,'jquery.cookie' //<- this is the real trick !!! ], function ($, _, Backbone, App) {
After that, I was able to find a jquery cookie.
BTW : There is no need to import JQuery.camera into your html if you use Require.js to extract it, if you do not use it outside the Require.js scope.
Cristiano fontes
source share