This package has been deprecated

Author message:

Use Bugsnag's official package instead: https://www.npmjs.com/package/@bugsnag/web-worker

bugsnag-js-windowless
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

Bugsnag JS Windowless

A Bugsnag client for all JS contexts without the window global.

This was made originally for Manifest V3 Chrome Extension background service workers, but works in all browser JS contexts.

npm i --save bugsnag-js-windowless
yarn add bugsnag-js-windowless
pnpm i bugsnag-js-windowless
import BugsnagJs from '@bugsnag/js';
import BugsnagSw from 'bugsnag-js-windowless';

const Bugsnag = typeof window === 'undefined' ? BugsnagSw : BugsnagJs;

Bugsnag.start({ apiKey: 'your-api-key' });

Features

  • Exact same API and types as @bugsnag/js (docs)
  • No dependencies

Todo

Differences

These are the differences between @bugsnag/js's and bugsnag-js-windowless's behavior that I don't care about for my use case. I will however accept PRs to add support for them!

  • Fetch/XHR request errors are not reported
  • Full session tracking (including config.autoTrackSessions) is not implemented
  • config.collectUserIp is not implemented and thus disabled by default
  • config.maxEvents is not implemented - all events are collected
  • config.trackInlineScripts is not implemented - this isn't really relevant to the JS contexts I built this for (chrome extension service workers)

Contributing

To get started contributing:

# Install PNPM
npm i -g pnpm

# Install dependencies
pnpm i

# Create a .env file (and include your api key)
cp .env.template .env
edit .env

# Start the demo application
pnpm start

# Run unit tests
pnpm test

# Type check and output to `dist/` directory
pnpm build

Package Sidebar

Install

npm i bugsnag-js-windowless

Weekly Downloads

45

Version

1.0.9

License

MIT

Unpacked Size

368 kB

Total Files

29

Last publish

Collaborators

  • _aklinker1