Last active
July 11, 2018 11:10
-
-
Save MickaelBergem/7f1c3901ba9050f3168a586ad5d39759 to your computer and use it in GitHub Desktop.
Register Sentry in a Vue.js project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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://[email protected]/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