Skip to content

Commit

Permalink
feat: Allow Sentry to Track React Components Name
Browse files Browse the repository at this point in the history
  • Loading branch information
rtau committed Jun 24, 2024
1 parent ff0c9ff commit 7924b3f
Show file tree
Hide file tree
Showing 3 changed files with 236 additions and 23 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"web-vitals": "^2.1.4"
},
"devDependencies": {
"@sentry/vite-plugin": "^2.16.1",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "13.3.0",
"@testing-library/user-event": "^14.2.1",
Expand Down
12 changes: 11 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import react from "@vitejs/plugin-react-swc";
import basicSsl from "@vitejs/plugin-basic-ssl";
import { VitePWA, VitePWAOptions } from "vite-plugin-pwa";
import eslint from "vite-plugin-eslint"
import { sentryVitePlugin } from "@sentry/vite-plugin";

// https://vitejs.dev/config/
export default defineConfig(({mode}: ConfigEnv) => {
Expand All @@ -14,7 +15,15 @@ export default defineConfig(({mode}: ConfigEnv) => {

}),
basicSsl(),
VitePWA(getPwaOptions(env))
VitePWA(getPwaOptions(env)),
sentryVitePlugin({
// Put the Sentry vite plugin after all other plugins: https://www.npmjs.com/package/@sentry/vite-plugin
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
// Auth tokens can be obtained from https://sentry.io/orgredirect/organizations/:orgslug/settings/auth-tokens/
authToken: process.env.SENTRY_AUTH_TOKEN,
reactComponentAnnotation: {enabled: true},
}),
],
server: {
https: false,
Expand All @@ -23,6 +32,7 @@ export default defineConfig(({mode}: ConfigEnv) => {
// strictPort: true,
},
build: {
sourcemap: true, // Source map generation must be turned on
outDir: "./build"
}
}
Expand Down
Loading

0 comments on commit 7924b3f

Please sign in to comment.