Skip to content

Commit e29930b

Browse files
committed
Added support for CommonJS/browserify.
1 parent d40a097 commit e29930b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/raven.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// If there is no JSON, we no-op the core features of Raven
55
// since JSON is required to encode the payload
66
var _Raven = window.Raven,
7-
hasJSON = !!(window.JSON && window.JSON.stringify),
7+
hasJSON = !!(typeof JSON === 'object' && JSON.stringify),
88
lastCapturedException,
99
lastEventId,
1010
globalServer,

template/_footer.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
// Expose Raven to the world
2-
window.Raven = Raven;
3-
4-
// AMD
52
if (typeof define === 'function' && define.amd) {
3+
// AMD
64
define('raven', [], function() { return Raven; });
5+
} else if (typeof module === 'object') {
6+
// CommonJS
7+
module.exports = Raven;
8+
} else {
9+
// Everything else
10+
window.Raven = Raven;
711
}
812

913
})(window);

0 commit comments

Comments
 (0)