项目中添加sentry记录一下配置
Sentry意思是哨兵,是一个开源的提供应用监控的一个平台,可以帮助我们获取应用在运行时出现的问题,可以使用平台集成的SaaS服务,也可以自己搭建服务。
我们的项目使用react+umi+dev 配置sentry基本参考react+webpack就可以了。
在项目中引入‘@sentry/webpack-plugin’、’umi-plugin-react’、’umi-plugin-react’
// 引入需要的库 |
/config/config.js中:
添加下列配置项:
其中devtool是配的source-map,chainWebpack内部的options可以参考https://github.com/getsentry/sentry-webpack-plugin
devtool: 'nosources-source-map', |
新建/.sentryclirc文件
配置 其中选项需要和sentry设置匹配,http://sentry.xiaoyuanhao.com:9000/auth/login/sentry/
[defaults] |
/src/app.js
增加 其中dsn 需要找运维http://121.43.34.186:40188/pages/viewpage.action?pageId=2036199
import * as Sentry from '@sentry/browser'; |