Skip to content

Instantly share code, notes, and snippets.

@samcday
Created November 8, 2011 23:54
Show Gist options
  • Save samcday/1349759 to your computer and use it in GitHub Desktop.
Save samcday/1349759 to your computer and use it in GitHub Desktop.
r.js does not set define.amd during optimization
define([
"myplugin!foo"
], function(result) {
console.log("plugin result:", result);
});
define(["plugindep"], function(dep) {
return {
load: function(name, parentRequire, load, config) {
if(!dep) {
console.log("It's broken :(");
process.exit(-1);
}
else {
load("It works.");
}
}
}
});
console.log("Has define():", !!define);
console.log("Has define.amd:", !!define.amd);
if(typeof define === "function" && define.amd) {
define(function() {
return {
importantinfo: "Yep."
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment