This module is not yet compatible with Nuxt 3
Head over to v2.nuxt.com
rollbar
Add Rollbar.js to your Nuxt app to automatically capture and report errors in your applications.
nuxt-rollbar-module
Rollbar module for NuxtJS
Setup
- Add
nuxt-rollbar-module
dependency using yarn or npm to your project
npm install --save nuxt-rollbar-moduleyarn 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: { // Addtional config } } ] ]}
Usage
Enter your project access tokens in the NuxtJS config file. See Rollbar javascript documentation for options.
Usage in Vue.js
Vue.rollbar.debug('Yohyo!')// or in a vue componentthis.$rollbar.debug('Yohyo!')
Usage in Nuxt.js
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!') }}
Options
Development
- Clone this repository
- Install dependencies using
yarn install
ornpm install
- Start development server using
npm run dev
License
Copyright (c) Gaël Reyrol me@gaelreyrol.com
Contributors 2