1.0.3 • Published 5 years ago

react-scripts-plugin-sentry v1.0.3

Weekly downloads
77
License
MIT
Repository
github
Last release
5 years ago

Integrate sentry.io with Create React App

Integrates sentry.io into the CRA yarn build script.

Install

yarn add -D react-scripts-plugin-sentry

Configuration

Add to cra.config.js

module.exports = {
  plugins: ['sentry'],
};

Create a .sentryclirc file in project

[defaults]
org = my-org
project = my-project
[auth]
token = xxxxx

Release matching

Releases are named as the value of git describe by default. To configure this, you can set SENTRY_RELEASE_TYPE in your dotenv to one of: VERSION (default), COMMITHASH, BRANCH (only if enabled). Variables of the same names are exported on process.env. This is all handled by git-revision-webpack-plugin, which you can further customize by setting GIT_REVISION_CONFIG in your dotenv to a JSON blob (see plugin's docs for API), for example:

SENTRY_RELEASE_TYPE=VERSION
GIT_REVISION_CONFIG={"lightweightTags": true}

For error reports to be matched correctly, make sure your front-end has raven-js configured to use the same value, eg:

import Raven from 'raven-js';

Raven.config('https://xxxxx@sentry.io/12345', {
  release: process.env.VERSION,
}).install();

Compatability

The official Create React App does not have a supported plugin system. This plugin is compatable with the following forks: