Skip to content

Instantly share code, notes, and snippets.

@MickaelBergem
Last active July 11, 2018 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MickaelBergem/7f1c3901ba9050f3168a586ad5d39759 to your computer and use it in GitHub Desktop.
Save MickaelBergem/7f1c3901ba9050f3168a586ad5d39759 to your computer and use it in GitHub Desktop.
Register Sentry in a Vue.js project
/* eslint-env node */
import Vue from 'vue';
// You should not have to import anything special before Raven
// Import Raven, Sentry's SDK
import Raven from 'raven-js';
import RavenVue from 'raven-js/plugins/vue';
// Import our local "config.js" file
import config from './config';
if (process.env.NODE_ENV === 'production') {
// Here goes the DSN
Raven
.config('https://xxxxxxxxxxxxxxxxxxxxxxxxx@sentry.io/xxxxxxx', {
// We also track the project's release to benefit from some of Sentry's advanced features
'release': config.SENTRY_RELEASE,
})
.addPlugin(RavenVue, Vue)
.install();
} else {
// You may remove this once you are sure everything works fine
console.debug('Not configuring Sentry, environment is', process.env.NODE_ENV);
}
// Here, import everything you need to setup you app
// If an error is thrown here, it will get caught by Sentry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment