Skip to content

Instantly share code, notes, and snippets.

@ecto
Created October 9, 2012 18:06
Show Gist options
  • Select an option

  • Save ecto/3860403 to your computer and use it in GitHub Desktop.

Select an option

Save ecto/3860403 to your computer and use it in GitHub Desktop.
/*
Example of achieving compatibility with AMD and standard CommonJS by putting boilerplate around the standard CommonJS module format:
*/
(function(define){
define(function(require,exports){
// module contents
var dep1 = require("dep1");
exports.someExportedFunction = function(){...};
//...
});
})(typeof define=="function"?define:function(factory){factory(require,exports)});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment