diff --git a/Gruntfile.coffee b/Gruntfile.coffee index a1eb400cb9..f13edd8bc6 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -14,6 +14,7 @@ module.exports = (grunt) -> global: true module: true define: true + require: true # The Good Parts eqeqeq: true diff --git a/src/bugsnag.js b/src/bugsnag.js index 2a74eb410e..066f0c1ebb 100644 --- a/src/bugsnag.js +++ b/src/bugsnag.js @@ -12,10 +12,18 @@ // The `Bugsnag` object is the only globally exported variable (function(definition) { if (typeof define === "function" && define.amd) { - // AMD/Require.js - define(function () { - return definition(window); - }); + // AMD + if (typeof require === "object" && require.load) { + // Require.js + define(function () { + return definition(window); + }); + } else { + // Almond.js + define("Bugsnag", function () { + return definition(window); + }); + } } else if (typeof module === "object" && typeof module.exports === "object") { // CommonJS/Browserify module.exports = definition(global);