Skip to content

Instantly share code, notes, and snippets.

@lukehedger
Created February 18, 2014 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukehedger/9069806 to your computer and use it in GitHub Desktop.
Save lukehedger/9069806 to your computer and use it in GitHub Desktop.
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