react-scripts-plugin-sentry

Integrates sentry.io into the CRA `yarn build` script.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
react-scripts-plugin-sentry
1.0.35 years ago5 years agoMinified + gzip package size for react-scripts-plugin-sentry in KB

Readme

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: