Skip to content

Conversation

@benvinegar
Copy link
Contributor

This converts raven-js to use CommonJS modules, internally. Distributables are built with Browserify.

(Same as #421, but made against the 2.x branch.)

Public API changes

  • For anyone using the CDN versions of Raven, nothing changes. Plugins automatically install as they did before.
  • If you are using Raven w/ CommonJS (e.g. Webpack or Browserify), plugins are now loaded like so:
var Raven = require('raven-js');
Raven
  .config('YOUR DSN')
  .addPlugin(require('raven-js/plugins/angular'))
  .addPlugin(require('raven-js/plugins/jquery'))
  .install();

Internal changes

A lot of internal changes that shouldn't affect users. Most notably, Raven itself is now a class instance, and most previously-private variables and functions are accessible as "private" object properties (e.g. Raven._globalOptions and Raven._handleStackInfo). They're aliased with an underscore for a reason – you shouldn't access these or assume anything about them.

This also means that Raven's API methods must be called with Raven as the this value. This could impact users if they have been aliasing Raven API functions directly, and not invoked them on the Raven object itself.

e.g.

// THIS WILL NO LONGER WORK
var Raven = require('raven-js');
var config = Raven.config;
var install = Raven.install;
config('YOUR DSN'); // "this" is window, not Raven
install();

Hopefully nobody does this.

@benvinegar benvinegar changed the title Refactor raven-js to use CommonJS modules, class instances Refactor raven-js to use CommonJS modules, class instances (2.x) Nov 23, 2015
benvinegar added a commit that referenced this pull request Nov 24, 2015
Refactor raven-js to use CommonJS modules, class instances (2.x)
@benvinegar benvinegar merged commit 3844fb6 into 2.x Nov 24, 2015
@mattrobenolt mattrobenolt deleted the modules branch January 4, 2016 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants