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
moduleexports = plugins: 'sentry';
Create a .sentryclirc
file in project
[defaults]org = my-orgproject = 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:
; Raven;
Compatability
The official Create React App does not have a supported plugin system. This plugin is compatable with the following forks: