Skip to content

Commit

Permalink
perf: 为 sentry 生成 sourcemap
Browse files Browse the repository at this point in the history
  • Loading branch information
wyx1818 committed Jun 15, 2021
1 parent 9666edb commit 7952e7e
Show file tree
Hide file tree
Showing 5 changed files with 1,750 additions and 1,599 deletions.
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 接口域名
REACT_APP_DOMAIN=xxx
# google analytic 追踪 ID
REACT_APP_GA=xxx
# Sentry DSN
REACT_APP_SENTRY_DSN=xxx
# 是否生成 sourcemap
GENERATE_SOURCEMAP=true
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
# YYeTs

YYeTsBot 前端

React App

自适应 PC、移动端,亮色、暗色模式

## 部署

1. 安装依赖

```shell
yarn
```

1. 复制 `.env.example``.env`,修改其中的变量

```dotenv
# 接口域名
REACT_APP_DOMAIN=xxx
# google analytic 追踪 ID
REACT_APP_GA=xxx
# Sentry DSN
REACT_APP_SENTRY_DSN=xxx
# 是否生成 sourcemap
GENERATE_SOURCEMAP=true
```

1. build 项目

```shell
yarn build
```
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"@material-ui/core": "^4.11.4",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.58",
"@sentry/cli": "^1.66.0",
"@sentry/react": "^6.7.0",
"@sentry/tracing": "^6.7.0",
"@testing-library/jest-dom": "^5.11.4",
Expand Down Expand Up @@ -35,11 +36,13 @@
"react-scripts": "4.0.3",
"react-transition-group": "^4.4.2",
"react-window": "^1.8.6",
"source-map-explorer": "^2.5.2",
"typescript": "^4.1.2",
"web-vitals": "^1.0.1",
"yup": "^0.32.9"
},
"scripts": {
"analyze": "source-map-explorer 'build/static/js/*.js'",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
Expand Down
18 changes: 10 additions & 8 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import { Integrations } from "@sentry/tracing";

import App from "./app/App";

Sentry.init({
dsn: process.env.REACT_APP_SENTRY_DSN,
integrations: [new Integrations.BrowserTracing()],
if (process.env.NODE_ENV === "development") {
Sentry.init({
dsn: process.env.REACT_APP_SENTRY_DSN,
integrations: [new Integrations.BrowserTracing()],

// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
});
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
});
}

ReactDOM.render(<App />, document.getElementById("root"));
Loading

0 comments on commit 7952e7e

Please sign in to comment.