Skip to content

Commit f5e88db

Browse files
committed
Merge pull request #261 from clayzermk1/master
Added support for CommonJS/browserify.
2 parents c0318fc + 44be740 commit f5e88db

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ module.exports = function(grunt) {
7070
},
7171
core: {
7272
src: coreFiles.concat(plugins),
73-
dest: 'build/<%= pkg.name %>.js'
73+
dest: 'build/raven.js'
7474
},
7575
all: {
7676
files: pluginConcatFiles

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 = !!(isObject(JSON) && JSON.stringify),
88
lastCapturedException,
99
lastEventId,
1010
globalServer,

template/_footer.js

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

918
})(window);

0 commit comments

Comments
 (0)