Created
February 18, 2014 12:13
-
-
Save lukehedger/9069806 to your computer and use it in GitHub Desktop.
RequireJS with non-AMD modules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Add definition to foot of module.js (the required file) | |
// AMD Define | |
define(function(){ | |
return baron; | |
}); | |
// 2. Add the path to main.js (requireJS config) as normal | |
require.config({ | |
baseUrl: "/sites/all/themes/base/js/", | |
paths: { | |
"underscore": "../vendor/underscore-min", | |
"baron": "../vendor/baron" | |
}, | |
shim: { | |
underscore: { | |
exports: "_" | |
} | |
} | |
}); | |
// 3. Require the file in app.js | |
define(["underscore", "../vendor/baron"], function(_, Baron) { | |
// use non-AMD module here | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment