What is @bugsnag/source-maps?
@bugsnag/source-maps is an npm package that helps you upload source maps to Bugsnag, a tool for monitoring and reporting errors in applications. Source maps are used to map minified code back to the original source code, making it easier to debug errors in production environments.
What are @bugsnag/source-maps's main functionalities?
Uploading Browser Source Maps
This feature allows you to upload source maps for browser-based applications. The code sample demonstrates how to upload a source map file along with the minified JavaScript file to Bugsnag.
const { upload } = require('@bugsnag/source-maps');
upload({
apiKey: 'YOUR_API_KEY',
appVersion: '1.2.3',
minifiedUrl: 'https://example.com/app.min.js',
sourceMap: 'path/to/app.min.js.map',
minifiedFile: 'path/to/app.min.js',
overwrite: true
}).then(() => {
console.log('Source map uploaded successfully');
}).catch(err => {
console.error('Failed to upload source map', err);
});
Uploading Node.js Source Maps
This feature allows you to upload source maps for Node.js applications. The code sample shows how to upload a source map file along with the corresponding minified JavaScript file to Bugsnag.
const { upload } = require('@bugsnag/source-maps');
upload({
apiKey: 'YOUR_API_KEY',
appVersion: '1.2.3',
sourceMap: 'path/to/app.js.map',
minifiedFile: 'path/to/app.js',
minifiedUrl: 'app.js',
overwrite: true
}).then(() => {
console.log('Source map uploaded successfully');
}).catch(err => {
console.error('Failed to upload source map', err);
});
Uploading React Native Source Maps
This feature allows you to upload source maps for React Native applications. The code sample demonstrates how to upload a source map file along with the minified JavaScript bundle for an iOS platform to Bugsnag.
const { upload } = require('@bugsnag/source-maps');
upload({
apiKey: 'YOUR_API_KEY',
appVersion: '1.2.3',
platform: 'ios',
sourceMap: 'path/to/main.jsbundle.map',
minifiedFile: 'path/to/main.jsbundle',
minifiedUrl: 'main.jsbundle',
overwrite: true
}).then(() => {
console.log('Source map uploaded successfully');
}).catch(err => {
console.error('Failed to upload source map', err);
});
Other packages similar to @bugsnag/source-maps
sentry-cli
sentry-cli is a command-line tool for Sentry, another error monitoring and reporting tool. It allows you to upload source maps, manage releases, and perform other Sentry-related tasks. Compared to @bugsnag/source-maps, sentry-cli offers a broader range of functionalities beyond just source map uploads.
airbrake-js
airbrake-js is an error monitoring library for Airbrake that includes functionalities for uploading source maps. It is similar to @bugsnag/source-maps in that it helps map minified code back to the original source code, but it is part of a broader library for error tracking.
@bugsnag/source-maps
Installation
You can install @bugsnag/source-maps locally to your project:
npm install --save-dev @bugsnag/source-maps
yarn add --dev @bugsnag/source-maps
You can then run the CLI using the convenience tools for each package manager:
npx bugsnag-source-maps [...args]
yarn run bugsnag-source-maps [...args]
Or you can install the bugsnag-source-maps
CLI tool globally on your system:
npm install --global @bugsnag/source-maps
yarn global add @bugsnag/source-maps
Usage
TODO link to docs
Support
TODO
Contributing
TODO
License
MIT