RequireJs: How To Define Extra Dependencies For 3rd Party Library
Basically I want to be able to load some module first before other. For example, I want bootstrap to load first before backbone. Can I declare dependencies like so? shim: { 'ba
Solution 1:
Yes, that is the way to do it (in the require.config({ ...
block of course.) It is also recommended to add an exports
key and set it to Backbone
. This will allow you to use Backbone inside a require
or define
block, as though it were a real AMD module:
define(['backbone'], function (Backbone) {
// Backbone here is the function parameter instead of the global reference
});
Read more here. In fact they even reference Backbone as their example!
Post a Comment for "RequireJs: How To Define Extra Dependencies For 3rd Party Library"