Skip to content

Commit

Permalink
fix: sentry 관련 기본적인 세팅 완료
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene028 committed Aug 3, 2024
1 parent ae33345 commit 6acb94a
Show file tree
Hide file tree
Showing 5 changed files with 210 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
},
"devDependencies": {
"@sentry/react": "^8.22.0",
"@sentry/vite-plugin": "^2.21.1",
"@storybook/addon-essentials": "^7.6.14",
"@storybook/addon-interactions": "^7.6.14",
"@storybook/addon-links": "^7.6.14",
Expand Down
183 changes: 183 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import App from '@/App';

import * as Sentry from '@sentry/react';
import RoutePath from '@/routes/routePath';
import { RouterProvider, createBrowserRouter } from 'react-router-dom';
import Layout from '@/components/layout/Layout';
Expand Down Expand Up @@ -32,12 +32,15 @@ import { DicordConnect } from '@/pages/DiscordConnect';
import { DiscordGuide } from '@/pages/DiscordGuide';
import { Suspense } from 'react';

const sentryCreateBrowserRouter =
Sentry.wrapCreateBrowserRouter(createBrowserRouter);

export const Routers = () => {
return <RouterProvider router={router} />;
};

// TODO: error page, meta tag
const router = createBrowserRouter([
const router = sentryCreateBrowserRouter([
{
path: RoutePath.Index,
element: <Layout />,
Expand Down
4 changes: 3 additions & 1 deletion src/utils/sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ Sentry.init({
tracesSampleRate: 1.0,
tracePropagationTargets: [
/^https:\/\/onboarding.gdschongik.com\/?.*$/,
/^https:\/\/api\.gdschongik\.com\/?.*$/
/^https:\/\/api\.gdschongik\.com\/?.*$/,
/^https:\/\/dev-onboarding.gdschongik.com\/?.*$/,
/^https:\/\/dev-api\.gdschongik\.com\/?.*$/
],
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0
Expand Down
19 changes: 18 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,24 @@ import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import tsconfigPaths from 'vite-tsconfig-paths';

import { sentryVitePlugin } from '@sentry/vite-plugin';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), tsconfigPaths()]
plugins: [
react(),
tsconfigPaths(),
sentryVitePlugin({
org: process.env.SENTRY_ORG_NAME,
project: process.env.SENTRY_PROJECT_NAME,
authToken: process.env.SENTRY_AUTH_TOKEN,
sourcemaps: {
assets: './dist/**',
filesToDeleteAfterUpload: '**/*.map'
}
})
],
build: {
sourcemap: true
}
});

0 comments on commit 6acb94a

Please sign in to comment.