Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ module.exports = function(grunt) {
},
core: {
src: coreFiles.concat(plugins),
dest: 'build/<%= pkg.name %>.js'
dest: 'build/raven.js'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this because the package.json is now raven-js ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah 😐

I noticed it and since it was from something I suggested, I figured I'd clob it in here. I have it on a separate commit and referenced the issue from the commit message.

},
all: {
files: pluginConcatFiles
Expand Down
2 changes: 1 addition & 1 deletion src/raven.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// If there is no JSON, we no-op the core features of Raven
// since JSON is required to encode the payload
var _Raven = window.Raven,
hasJSON = !!(window.JSON && window.JSON.stringify),
hasJSON = !!(isObject(JSON) && JSON.stringify),
lastCapturedException,
lastEventId,
globalServer,
Expand Down
17 changes: 13 additions & 4 deletions template/_footer.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
// Expose Raven to the world
window.Raven = Raven;

// AMD
if (typeof define === 'function' && define.amd) {
define('raven', [], function() { return Raven; });
// AMD
define('raven', function(Raven) {
return (window.Raven = Raven);
});
} else if (isObject(module)) {
// browserify
module.exports = Raven;
} else if (isObject(exports)) {
// CommonJS
exports = Raven;
} else {
// Everything else
window.Raven = Raven;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we can't do this. It also needs to exist on the global scope for AMD to make plugins work.

So until someone else redesigns those, we can't do this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wtf is that garbage

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, I'll accept that if it stops this back and forth argument. So gross though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think anyone using browserify will be fine with https://github.com/umdjs/umd/blob/master/returnExportsGlobal.js which seems a little cleaner and more straightforward. What would you like to support: CommonJS or browserify? From the issues, it seems as though most people are interested in browserify.

}

})(window);