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