From 4aae3605db21f9e0cc21f7498aa192353b21e625 Mon Sep 17 00:00:00 2001 From: six-standard Date: Tue, 22 Apr 2025 12:06:14 +0900 Subject: [PATCH 1/5] =?UTF-8?q?refactor:=20=EC=86=8C=EC=8A=A4=EB=A7=B5=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EA=B4=80=EB=A0=A8=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- next.config.mjs | 12 +++++++----- sentry.client.config.ts | 7 +++---- sentry.edge.config.ts | 3 ++- sentry.server.config.ts | 3 ++- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/next.config.mjs b/next.config.mjs index b5ba0b5..e983b73 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -4,15 +4,17 @@ const nextConfig = { reactStrictMode: true, experimental: { forceSwcTransforms: true }, output: 'standalone', - + productionBrowserSourceMaps: false, webpack: (config, options) => { config.module.rules.push({ test: /\.svg$/i, - use: [ - options.defaultLoaders.babel, - { loader: '@svgr/webpack', options: { babel: false } }, - ], + use: [options.defaultLoaders.babel, { loader: '@svgr/webpack', options: { babel: false } }], }); + if (!options.dev) { + config.devtool = + process.env.NODE_ENV === 'production' ? 'hidden-source-map' : 'inline-source-map'; + } + return config; }, diff --git a/sentry.client.config.ts b/sentry.client.config.ts index 0ae106c..fa4705e 100644 --- a/sentry.client.config.ts +++ b/sentry.client.config.ts @@ -9,12 +9,10 @@ Sentry.init({ dsn: env.SENTRY_DSN, // Add optional integrations for additional features - integrations: [ - Sentry.replayIntegration({ maskAllText: false, blockAllMedia: false }), - ], + integrations: [Sentry.replayIntegration({ maskAllText: false, blockAllMedia: false })], // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control. - tracesSampleRate: env.NODE_ENV === 'production' ? 0.1 : 1, + tracesSampleRate: 0.1, // Define how likely Replay events are sampled. // This sets the sample rate to be 10%. You may want this to be 100% while @@ -26,4 +24,5 @@ Sentry.init({ // Setting this option to true will print useful information to the console while you're setting up Sentry. debug: false, + enabled: process.env.NODE_ENV === 'production', }); diff --git a/sentry.edge.config.ts b/sentry.edge.config.ts index e76de79..9ec240c 100644 --- a/sentry.edge.config.ts +++ b/sentry.edge.config.ts @@ -10,8 +10,9 @@ Sentry.init({ dsn: env.SENTRY_DSN, // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control. - tracesSampleRate: env.NODE_ENV === 'production' ? 0.05 : 1, + tracesSampleRate: 0.05, // Setting this option to true will print useful information to the console while you're setting up Sentry. debug: false, + enabled: process.env.NODE_ENV === 'production', }); diff --git a/sentry.server.config.ts b/sentry.server.config.ts index bac1d94..19cb346 100644 --- a/sentry.server.config.ts +++ b/sentry.server.config.ts @@ -9,8 +9,9 @@ Sentry.init({ dsn: env.SENTRY_DSN, // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control. - tracesSampleRate: env.NODE_ENV === 'production' ? 0.1 : 1, + tracesSampleRate: 0.1, // Setting this option to true will print useful information to the console while you're setting up Sentry. debug: false, + enabled: process.env.NODE_ENV === 'production', }); From 7191e137794b0e114d919a1ec390d8439d8b9c29 Mon Sep 17 00:00:00 2001 From: six-standard Date: Tue, 22 Apr 2025 13:45:49 +0900 Subject: [PATCH 2/5] =?UTF-8?q?modfy:=20=EC=86=8C=EC=8A=A4=EB=A7=B5=20?= =?UTF-8?q?=EC=97=85=EB=A1=9C=EB=93=9C=20=EA=B3=BC=EC=A0=95=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-publish.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index b20532a..ea52f35 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -22,6 +22,7 @@ jobs: - name: Install dependencies run: | npm install -g pnpm + npm install -g @sentry/cli pnpm install --frozen-lockfile - name: Create .env file @@ -40,6 +41,16 @@ jobs: run: | pnpm run build + - name: Upload Source Maps + run: | + sentry-cli releases new production + sentry-cli sourcemaps inject .next/static/chunks + sentry-cli releases files production upload-sourcemaps .next/static/chunks + env: + SENTRY_AUTH_TOKEN: ${{ secrets.NEXT_PUBLIC_SENTRY_AUTH_TOKEN }} + SENTRY_ORG: velog-dashboard2 + SENTRY_PROJECT: vd-fe + # Docker 로그인 - name: Log in to Docker Hub uses: docker/login-action@v3 From 112f2a8b8676bd13eacc3bda9d253dad59be726a Mon Sep 17 00:00:00 2001 From: six-standard Date: Tue, 22 Apr 2025 16:05:35 +0900 Subject: [PATCH 3/5] =?UTF-8?q?modify:=20=EC=9D=BC=EB=B6=80=20=EB=88=84?= =?UTF-8?q?=EB=9D=BD=EB=90=9C=20=EC=BD=94=EB=93=9C=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-publish.yaml | 1 + sentry.client.config.ts | 1 + sentry.edge.config.ts | 1 + sentry.server.config.ts | 1 + 4 files changed, 4 insertions(+) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index ea52f35..51f2677 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -46,6 +46,7 @@ jobs: sentry-cli releases new production sentry-cli sourcemaps inject .next/static/chunks sentry-cli releases files production upload-sourcemaps .next/static/chunks + sentry-cli releases finalize production env: SENTRY_AUTH_TOKEN: ${{ secrets.NEXT_PUBLIC_SENTRY_AUTH_TOKEN }} SENTRY_ORG: velog-dashboard2 diff --git a/sentry.client.config.ts b/sentry.client.config.ts index fa4705e..8dfe0e2 100644 --- a/sentry.client.config.ts +++ b/sentry.client.config.ts @@ -7,6 +7,7 @@ import { env } from '@/constants'; Sentry.init({ dsn: env.SENTRY_DSN, + release: 'production', // Add optional integrations for additional features integrations: [Sentry.replayIntegration({ maskAllText: false, blockAllMedia: false })], diff --git a/sentry.edge.config.ts b/sentry.edge.config.ts index 9ec240c..78238d0 100644 --- a/sentry.edge.config.ts +++ b/sentry.edge.config.ts @@ -8,6 +8,7 @@ import { env } from '@/constants'; Sentry.init({ dsn: env.SENTRY_DSN, + release: 'production', // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control. tracesSampleRate: 0.05, diff --git a/sentry.server.config.ts b/sentry.server.config.ts index 19cb346..91dfd02 100644 --- a/sentry.server.config.ts +++ b/sentry.server.config.ts @@ -7,6 +7,7 @@ import { env } from '@/constants'; Sentry.init({ dsn: env.SENTRY_DSN, + release: 'production', // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control. tracesSampleRate: 0.1, From 12eb688f1cb0508699df029593d316e08a4f3d4b Mon Sep 17 00:00:00 2001 From: six-standard Date: Fri, 25 Apr 2025 09:33:39 +0900 Subject: [PATCH 4/5] =?UTF-8?q?refactor:=20=EC=84=BC=ED=8A=B8=EB=A6=AC=20?= =?UTF-8?q?=EC=86=8C=EC=8A=A4=EB=A7=B5=20=EC=9D=B4=EC=8A=88=20=EC=99=84?= =?UTF-8?q?=EB=B2=BD=20=ED=95=B4=EA=B2=B0=20=EC=98=B5=EC=85=98=EA=B0=92?= =?UTF-8?q?=EC=9D=84=20=EC=88=98=EC=A0=95=ED=95=98=EB=8B=88=20@sentry/next?= =?UTF-8?q?js=20=EC=9E=90=EC=B2=B4=20=EC=86=8C=EC=8A=A4=EB=A7=B5=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=EC=9D=84=20=ED=86=B5=ED=95=B4=20=EC=A0=95?= =?UTF-8?q?=EC=83=81=EC=A0=81=EC=9C=BC=EB=A1=9C=20=EC=86=8C=EC=8A=A4?= =?UTF-8?q?=EB=A7=B5=EC=9D=B4=20=EC=97=85=EB=A1=9C=EB=93=9C=EB=90=98?= =?UTF-8?q?=EB=8A=94=20=EA=B2=83=EC=9D=84=20=ED=99=95=EC=9D=B8=ED=95=98?= =?UTF-8?q?=EC=98=80=EC=8A=B5=EB=8B=88=EB=8B=A4!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-publish.yaml | 12 ------- next.config.mjs | 46 +++++++-------------------- 2 files changed, 12 insertions(+), 46 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 51f2677..b20532a 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -22,7 +22,6 @@ jobs: - name: Install dependencies run: | npm install -g pnpm - npm install -g @sentry/cli pnpm install --frozen-lockfile - name: Create .env file @@ -41,17 +40,6 @@ jobs: run: | pnpm run build - - name: Upload Source Maps - run: | - sentry-cli releases new production - sentry-cli sourcemaps inject .next/static/chunks - sentry-cli releases files production upload-sourcemaps .next/static/chunks - sentry-cli releases finalize production - env: - SENTRY_AUTH_TOKEN: ${{ secrets.NEXT_PUBLIC_SENTRY_AUTH_TOKEN }} - SENTRY_ORG: velog-dashboard2 - SENTRY_PROJECT: vd-fe - # Docker 로그인 - name: Log in to Docker Hub uses: docker/login-action@v3 diff --git a/next.config.mjs b/next.config.mjs index e983b73..3a062ab 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -4,7 +4,7 @@ const nextConfig = { reactStrictMode: true, experimental: { forceSwcTransforms: true }, output: 'standalone', - productionBrowserSourceMaps: false, + productionBrowserSourceMaps: true, webpack: (config, options) => { config.module.rules.push({ test: /\.svg$/i, @@ -26,41 +26,19 @@ const nextConfig = { }, }; export default withSentryConfig(nextConfig, { - // For all available options, see: - // https://github.com/getsentry/sentry-webpack-plugin#options + // 센트리 동작을 위한 기본값 + authToken: process.env.NEXT_PUBLIC_SENTRY_AUTH_TOKEN, + org: 'velog-dashboardv2', + project: 'vd-fe', - org: 'velog-dashboard', - project: 'velog-dashboard-fe', + widenClientFileUpload: true, // 파일의 크기가 비교적 큰 대신, 더 상세한 정보를 포함하는 소스맵 파일 생성 + sourcemaps: { deleteSourcemapsAfterUpload: true }, // 소스맵 파일 업로드 후 자동 제거 + hideSourceMaps: true, // 클라이언트 대상의 소스맵 파일 은닉 - // Only print logs for uploading source maps in CI - silent: !process.env.CI, + silent: !process.env.CI, // CI 진행시에만 로그가 표시되도록 강제 + disableLogger: true, // 번들 사이즈 감소를 위해 센트리 기본 로그 메세지 트리셰이크 - // For all available options, see: - // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/ + reactComponentAnnotation: { enabled: true }, // 세션 리플레이와 브레드크럼에서 상세한 컴포넌트명 표시 - // Upload a larger set of source maps for prettier stack traces (increases build time) - widenClientFileUpload: true, - - // Automatically annotate React components to show their full name in breadcrumbs and session replay - reactComponentAnnotation: { - enabled: true, - }, - - // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers. - // This can increase your server load as well as your hosting bill. - // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client- - // side errors will fail. - tunnelRoute: '/monitoring', - - // Hides source maps from generated client bundles - hideSourceMaps: true, - - // Automatically tree-shake Sentry logger statements to reduce bundle size - disableLogger: true, - - // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.) - // See the following for more information: - // https://docs.sentry.io/product/crons/ - // https://vercel.com/docs/cron-jobs - automaticVercelMonitors: true, + tunnelRoute: '/monitoring', // ad-blocker 우회를 위한 경로 (저희가 이전에 왜 생기는지 이유를 추측했던 그 경로 맞습니다..) }); From db378aebfc9a80d98f237df009a264be8de1b5e2 Mon Sep 17 00:00:00 2001 From: six-standard Date: Fri, 25 Apr 2025 09:50:04 +0900 Subject: [PATCH 5/5] =?UTF-8?q?refactor:=20=EA=B0=80=EB=8F=85=EC=84=B1?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=9C=20=EC=A4=84=EB=84=98=EA=B9=80=20?= =?UTF-8?q?=EC=82=BD=EC=9E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- next.config.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/next.config.mjs b/next.config.mjs index 3a062ab..6565eff 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -25,6 +25,7 @@ const nextConfig = { ], }, }; + export default withSentryConfig(nextConfig, { // 센트리 동작을 위한 기본값 authToken: process.env.NEXT_PUBLIC_SENTRY_AUTH_TOKEN,