New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@honeybadger-io/rollup-plugin

Package Overview
Dependencies
Maintainers
0
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@honeybadger-io/rollup-plugin

A rollup plugin to upload sourcemaps to Honeybadger

  • 5.10.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Honeybadger's Rollup Source Map Plugin

Rollup plugin to upload JavaScript source maps and optionally send deployment notifications to Honeybadger.

Supports rollup version 3. If you use rollup version 2, you can either upgrade or send your source maps to Honeybadger's API directly.

Installation

# npm
npm install @honeybadger-io/rollup-plugin --save-dev

# yarn
yarn add @honeybadger-io/rollup-plugin --dev

Configuration

Plugin parameters

These plugin parameters correspond to the Honeybadger Source Map Upload API and Deployments API.

apiKey (required)
The API key of your Honeybadger project
assetsUrl (required)
The base URL to production assets (scheme://host/path)*wildcards are supported. The plugin combines assetsUrl with the generated minified js file name to build the API parameter minified_url
endpoint (optional — default: "https://api.honeybadger.io/v1/source_maps")
Where to upload your source maps to. Perhaps you have a self hosted source map server you would like to upload your source maps to instead of Honeybadger. If you are using our EU stack, this should be set to "https://eu-api.honeybadger.io/v1/source_maps".
revision (optional — default: "main")
The deploy revision (i.e. commit hash) that your source map applies to. This could also be a code version. For best results, set it to something unique every time your code changes. See the Honeybadger docs for examples.
silent (optional — default: false)
If true, silence logging emitted by the plugin.
retries (optional — default: 3, max: 10)
This package implements fetch retry functionality via the fetch-retry package. Retrying helps fix issues like `ECONNRESET` and `SOCKETTIMEOUT` errors.
workerCount (optional — default: 5, min: 1)
Source maps are uploaded in parallel by a configurable number of workers. Increase or decrease this value to configure how many source maps are being uploaded in parallel.
Limited parallelism helps with connection issues in Docker environments.
ignorePaths (optional — default: [])
An array of paths (glob patterns) to ignore when uploading source maps. Uses picomatch to match against paths.
deployEndpoint (optional — default: "https://api.honeybadger.io/v1/deploys")
Where to send deployment notifications. If you are using our EU stack, this should be set to "https://eu-api.honeybadger.io/v1/deploys".
deploy (optional — default: false)
Configuration for deployment notifications. To disable deployment notifications, ignore this option. To enable deployment notifications, set this to true, or to an object containing any of the fields below. Your deploy's revision will be set to the same value as for your source maps (see above).
environment
The environment name, for example, "production"
repository
The base URL of the VCS repository (HTTPS-style), for example, "https://github.com/yourusername/yourrepo"
localUsername
The name of the user that triggered this deploy, for example, "Jane"
developmentEnvironments (optional — default: ["dev", "development", "test"])
Used to decide whether source maps should be uploaded or not.

rollup.config.js

Set output.sourcemap to true or 'hidden'. Add the honeybadger plugin to the plugins array.

import honeybadgerRollupPlugin from '@honeybadger-io/rollup-plugin'

// See plugin params above
const hbPluginOptions = {
  apiKey: 'your_key_here', 
  assetsUrl: 'https://yoursite.foo'
}

export default {
  input: 'src/index.js', 
  output: { 
    dir: 'dist', 
    sourcemap: true // Must be true or 'hidden'
  }, 
  plugins: [ honeybadgerRollupPlugin(hbPluginOptions) ],
}

Using Vite: vite.config.js

If you're using Vite, you'll set up vite.config.js instead of rollup.config.js.

Set build.sourcemap to true or 'hidden'. Add the honeybadger plugin to rollupOptions.plugins.

Note: Be careful not to add it to the top-level vite plugins without additional config, or it will upload source maps on serve rather than just on build.

import honeybadgerRollupPlugin from '@honeybadger-io/rollup-plugin'
import { defineConfig } from 'vite'

// See plugin params above
const hbPluginOptions = {
  apiKey: 'your_key_here', 
  assetsUrl: 'https://yoursite.foo'
}

export default defineConfig({
  plugins: [], // Not here
  build: {
    sourcemap: true, // Must be true or 'hidden'
    rollupOptions: {
      plugins: [ honeybadgerRollupPlugin(hbPluginOptions) ]
    }
  }
})

Development

  1. Run npm install
  2. Run the tests with npm test
  3. Build with npm run build

See the /examples folder for projects to test against.

License

This package is MIT licensed. See the MIT-LICENSE file in this folder for details.

Keywords

FAQs

Package last updated on 25 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc