Skip to content

react/vite/Sentry환경에서 Sourcemap 유출 방지하기 #58

Closed Answered by ej31
whdmldus1116 asked this question in Q&A
Discussion options

You must be logged in to vote

마크다운 문법만 수정해서 다시 올립니다.


TypeScript+Vite+Sentry

vite.config.ts 파일에

export default defineConfig(~~~~~
  const isProduction = process.env.BUILD_APP_TYPE === 'production';
  return {~~~ 
  plugins: [
      react(),
      isProduction &&
        sentryVitePlugin({
          org: 'slimdealz',
          project: 'slimdealz',
          authToken: process.env.VITE_SENTRY_AUTH_TOKEN, // 여기서 변경
          sourcemaps: {
            assets: './dist/**',
            filesToDeleteAfterUpload: '**/*.map'
          }
        })
    ].filter(Boolean), // 플러그인 리스트에서 false 값을 제거
    build: {
      outDir: 'dist',
      sourcemap: isProduction // 프로덕션 빌드에서만 sourcemap 생성
    },

코드 추가


Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ZZ3n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants