Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
RequireJS with non-AMD modules
// 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