Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-bugsnag

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-bugsnag

Report builds and upload source maps to Bugsnag

  • 2.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16K
decreased by-8.64%
Maintainers
1
Weekly downloads
 
Created
Source

vite-plugin-bugsnag

Report builds and upload source maps to bugsnag


Why? 🤔

There is no official plugin from Bugsnag for Vite.js.

This plugin provides the same functionality as webpack-bugsnag-plugins in Vite.js.

The API is similar to simplify the migration when moving away from Webpack.

Features ⚡️

  • 🔒 Written in TypeScript
  • 🚀 Quick setup with Vite plugins
  • 📖 Config options are fully documented in JSDoc

Installation 💿

Install the package as a development dependency:

npm i -D vite-plugin-bugsnag # yarn add -D vite-plugin-bugsnag

Usage 🚀

Two plugins are provided, one to report build information, and another one to upload sourcemaps.

Both plugins accept apiKey, appVersion, and endpoint, so you can share a config object.

For example:

import { defineConfig } from 'vite'
import { BugsnagBuildReporterPlugin, BugsnagSourceMapUploaderPlugin } from 'vite-plugin-bugsnag'

const isDistEnv = process.env.RAILS_ENV === 'production'

const bugsnagOptions = {
  apiKey: process.env.BUGSNAG_API_KEY,
  appVersion: process.env.APP_VERSION,
}

export default defineConfig({
  plugins: [
    isDistEnv && BugsnagBuildReporterPlugin({ ...bugsnagOptions, releaseStage: process.env.RAILS_ENV }),
    isDistEnv && BugsnagSourceMapUploaderPlugin({ ...bugsnagOptions, overwrite: true }),
  ],
})

BugsnagBuildReporterPlugin (options)

Use this plugin to report your application's build to Bugsnag.

import { defineConfig } from 'vite'
import { BugsnagBuildReporterPlugin } from 'vite-plugin-bugsnag'

export default defineConfig({
  plugins: [
    BugsnagBuildReporterPlugin({
      apiKey: 'YOUR_API_KEY',
      appVersion: '1.2.3',
    }),
  ],
})
  • It can auto detect source control from .git, .hg and package.json
  • Hooks into writeBundle to upload the information once the build is finished
  • If the build fails, the build report will not be sent

BugsnagSourceMapUploaderPlugin (options)

Use this plugin to upload your application's sourcemaps to Bugsnag.

import { defineConfig } from 'vite'
import { BugsnagSourceMapUploaderPlugin } from 'vite-plugin-bugsnag'

export default defineConfig({
  build: {
    sourcemap: true,
  },
  plugins: [
    BugsnagSourceMapUploaderPlugin({
      apiKey: 'YOUR_API_KEY',
      appVersion: '1.2.3',
      base: 'https://your-app.xyz/assets/',
    }),
  ],
})

License

This library is available as open source under the terms of the MIT License.

Keywords

FAQs

Package last updated on 14 Jul 2022

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