1.1.0 • Published 4 years ago

nuxt-rollbar-module v1.1.0

Weekly downloads
2,224
License
MIT
Repository
github
Last release
4 years ago

nuxt-rollbar-module

npm (scoped with tag) npm CircleCI Codecov Dependencies js-standard-style

Rollbar module for NuxtJS

Setup

  • 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 to modules section of nuxt.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 component
this.$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 or npm install
  • Start development server using npm run dev

License

MIT License

Copyright (c) Gaël Reyrol me@gaelreyrol.com

1.1.0

4 years ago

1.0.1

5 years ago

1.0.0

6 years ago

1.0.0-dev

6 years ago

0.0.0-dev

6 years ago