Rollbar module for NuxtJS
- Add
nuxt-rollbar-module
dependency using yarn or npm to your project
npm install --save nuxt-rollbar-module
yarn add nuxt-rollbar-module
- Add
nuxt-rollbar-module
tomodules
section ofnuxt.config.js
{
modules: [
// Simple usage
'nuxt-rollbar-module',
// With options
[
'nuxt-rollbar-module',
{
serverAccessToken: 'YOUR_ROLLBAR_SERVER_TOKEN',
clientAccessToken: 'YOUR_ROLLBAR_CLIENT_TOKEN',
config: {
// Additional config
}
}
]
]
}
Enter your project access tokens in the NuxtJS config file. See Rollbar javascript documentation for options.
Vue.rollbar.debug('Yohyo!')
// or in a vue component
this.$rollbar.debug('Yohyo!')
export default {
asyncData(context) {
// called by only server side
context.$rollbar.debug('Yohyo!')
},
created() {
// called by both server side and client side
this.$rollbar.debug('Yohyo!')
if (process.server) {
this.$rollbar.debug('from server side')
}
if (process.client) {
this.$rollbar.debug('from client side')
}
},
mounted() {
// called by only client side
this.$rollbar.debug('Yohyo!')
}
}
- Clone this repository
- Install dependencies using
npm ci
- Start development server using
npm run dev
Copyright (c) Gaël Reyrol [email protected]