Skip to content

Commit 8a7369a

Browse files
authored
[25.04.22 / TASK-173] Refactor - 센트리 소스맵 이슈 해결 (#30)
1 parent fcce2d7 commit 8a7369a

File tree

4 files changed

+27
-41
lines changed

4 files changed

+27
-41
lines changed

next.config.mjs

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ const nextConfig = {
55
reactStrictMode: true,
66
experimental: { forceSwcTransforms: true },
77
output: 'standalone',
8-
hideSourceMaps: true,
9-
productionBrowserSourceMaps: false,
8+
productionBrowserSourceMaps: true,
109
webpack: (config, options) => {
1110
config.module.rules.push({
1211
test: /\.svg$/i,
1312
use: [options.defaultLoaders.babel, { loader: '@svgr/webpack', options: { babel: false } }],
1413
});
14+
if (!options.dev) {
15+
config.devtool =
16+
process.env.NODE_ENV === 'production' ? 'hidden-source-map' : 'inline-source-map';
17+
}
1518

1619
return config;
1720
},
@@ -23,42 +26,21 @@ const nextConfig = {
2326
],
2427
},
2528
};
26-
export default withSentryConfig(nextConfig, {
27-
// For all available options, see:
28-
// https://github.com/getsentry/sentry-webpack-plugin#options
29-
30-
org: 'velog-dashboard',
31-
project: 'velog-dashboard-fe',
32-
33-
// Only print logs for uploading source maps in CI
34-
silent: !process.env.CI,
35-
36-
// For all available options, see:
37-
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
3829

39-
// Upload a larger set of source maps for prettier stack traces (increases build time)
40-
widenClientFileUpload: true,
41-
42-
// Automatically annotate React components to show their full name in breadcrumbs and session replay
43-
reactComponentAnnotation: {
44-
enabled: true,
45-
},
30+
export default withSentryConfig(nextConfig, {
31+
// 센트리 동작을 위한 기본값
32+
authToken: process.env.NEXT_PUBLIC_SENTRY_AUTH_TOKEN,
33+
org: 'velog-dashboardv2',
34+
project: 'vd-fe',
4635

47-
// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
48-
// This can increase your server load as well as your hosting bill.
49-
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
50-
// side errors will fail.
51-
tunnelRoute: '/monitoring',
36+
widenClientFileUpload: true, // 파일의 크기가 비교적 큰 대신, 더 상세한 정보를 포함하는 소스맵 파일 생성
37+
sourcemaps: { deleteSourcemapsAfterUpload: true }, // 소스맵 파일 업로드 후 자동 제거
38+
hideSourceMaps: true, // 클라이언트 대상의 소스맵 파일 은닉
5239

53-
// Hides source maps from generated client bundles
54-
hideSourceMaps: true,
40+
silent: !process.env.CI, // CI 진행시에만 로그가 표시되도록 강제
41+
disableLogger: true, // 번들 사이즈 감소를 위해 센트리 기본 로그 메세지 트리셰이크
5542

56-
// Automatically tree-shake Sentry logger statements to reduce bundle size
57-
disableLogger: true,
43+
reactComponentAnnotation: { enabled: true }, // 세션 리플레이와 브레드크럼에서 상세한 컴포넌트명 표시
5844

59-
// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
60-
// See the following for more information:
61-
// https://docs.sentry.io/product/crons/
62-
// https://vercel.com/docs/cron-jobs
63-
automaticVercelMonitors: true,
45+
tunnelRoute: '/monitoring', // ad-blocker 우회를 위한 경로 (저희가 이전에 왜 생기는지 이유를 추측했던 그 경로 맞습니다..)
6446
});

sentry.client.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ import { env } from '@/constants';
77

88
Sentry.init({
99
dsn: env.SENTRY_DSN,
10+
release: 'production',
1011

1112
// Add optional integrations for additional features
12-
integrations: [
13-
Sentry.replayIntegration({ maskAllText: false, blockAllMedia: false }),
14-
],
13+
integrations: [Sentry.replayIntegration({ maskAllText: false, blockAllMedia: false })],
1514

1615
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
17-
tracesSampleRate: env.NODE_ENV === 'production' ? 0.1 : 1,
16+
tracesSampleRate: 0.1,
1817

1918
// Define how likely Replay events are sampled.
2019
// This sets the sample rate to be 10%. You may want this to be 100% while
@@ -26,4 +25,5 @@ Sentry.init({
2625

2726
// Setting this option to true will print useful information to the console while you're setting up Sentry.
2827
debug: false,
28+
enabled: process.env.NODE_ENV === 'production',
2929
});

sentry.edge.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ import { env } from '@/constants';
88

99
Sentry.init({
1010
dsn: env.SENTRY_DSN,
11+
release: 'production',
1112

1213
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
13-
tracesSampleRate: env.NODE_ENV === 'production' ? 0.05 : 1,
14+
tracesSampleRate: 0.05,
1415

1516
// Setting this option to true will print useful information to the console while you're setting up Sentry.
1617
debug: false,
18+
enabled: process.env.NODE_ENV === 'production',
1719
});

sentry.server.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ import { env } from '@/constants';
77

88
Sentry.init({
99
dsn: env.SENTRY_DSN,
10+
release: 'production',
1011

1112
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
12-
tracesSampleRate: env.NODE_ENV === 'production' ? 0.1 : 1,
13+
tracesSampleRate: 0.1,
1314

1415
// Setting this option to true will print useful information to the console while you're setting up Sentry.
1516
debug: false,
17+
enabled: process.env.NODE_ENV === 'production',
1618
});

0 commit comments

Comments
 (0)