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 Apr 14, 2024
1 parent 4276d09 commit fe21f97
Show file tree
Hide file tree
Showing 3 changed files with 399 additions and 11 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,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 @@ -2,19 +2,29 @@ import { ConfigEnv, defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react-swc";
import basicSsl from "@vitejs/plugin-basic-ssl";
import { VitePWA, VitePWAOptions } from "vite-plugin-pwa";
import { sentryVitePlugin } from "@sentry/vite-plugin";

// https://vitejs.dev/config/
export default defineConfig(({mode}: ConfigEnv) => {
const env = loadEnv(mode, process.cwd(), "");
return {
plugins: [react(), basicSsl(), VitePWA(getPwaOptions(env))],
plugins: [react(), basicSsl(), 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,
host: true,
// port: parseInt(env.PORT ?? "9100", 10),
// strictPort: true,
},
build: {
sourcemap: true, // Source map generation must be turned on
outDir: "./build"
}
}
Expand Down
Loading

0 comments on commit fe21f97

Please sign in to comment.