1.2.0 • Published 8 months ago

@honeybadger-io/esbuild-plugin v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Honeybadger's esbuild Source Map Plugin

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

Installation

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

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

Configuration

Plugin parameters

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

esbuild.config.js

Set sourcemap to true. Add the honeybadger plugin to the plugins array.

import { honeybadgerSourceMapPlugin } from '@honeybadger-io/esbuild-plugin'

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

esbuild
    .build({
        entryPoints: ['src/index.ts'],
        bundle: true,
        minify: true,
        format: 'cjs',
        sourcemap: true,
        outfile: 'dist/output.js',
        plugins: [honeybadgerSourceMapPlugin(hbPluginOptions)]
    })
    .then(() => {
        console.log('Build complete')
    })
    .catch((err) => {
        console.error(err)
        process.exit(1)
    });

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.