How to load
@bugsnag/js using the CDN
For browser-only error reporting, we provide a hosted option on our CDN. This means you can get started with Bugsnag with a simple
To load Bugsnag from the CDN, add the following script tags to the
<head/> of your page:
<script src="//d2wy8f7a9ursnm.cloudfront.net/v6/bugsnag.min.js"></script> <script>window.bugsnagClient = bugsnag('YOUR_API_KEY')</script>
The first line loads the Bugsnag library from the CDN and the second configures it with your API key. You can alternatively supply a configuration object as documented in configuration options.
You can tweak the exact URL depending on whether you want to lock to a specific version or accepting varying levels of updates. Each release is versioned according to semver.
The URL in the example below specifies the version to be
6 is just the “major” semver component. This means you would receive new minor and patch versions automatically as they are published:
When a new major version of
@bugsnag/js is released, you will need to update the URL accordingly to receive updates.
To only allow patch updates, specify the major and minor components:
Or, lock down an exact version:
See semver.org for information on the semantics of version numbers.
We recommend pinning to a specific version and periodically updating.
Automatically accepting new versions of dependencies in your software is convenient, but has tradeoffs. Whilst we make every effort to be conservative and cautious with our minor/patch releases, unforeseen issues and incompatibilities can arise.
For these reasons, the safest approach involves manually updating the version, testing it in a development/staging environment and only then shipping to production.
To use the non-minified version, substitute
bugsnag.js in your script tag.
The minified version ships with source maps, so there are very few use cases where you would want the non-minified version (for example, debugging an issue in a browser that doesn’t support source maps).
<!-- only do this in development or for debugging purposes --> <script src="//d2wy8f7a9ursnm.cloudfront.net/v6/bugsnag.js"></script>