mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-06 17:36:50 +08:00
feat: use react sentry to support pass config via runtime (#350)
This commit is contained in:
@@ -1,11 +1,3 @@
|
||||
const { withSentryConfig } = require('@sentry/nextjs')
|
||||
|
||||
const isDevelopment = process.env.NODE_ENV === 'development'
|
||||
const SENTRY_DSN = process.env.NEXT_PUBLIC_SENTRY_DSN
|
||||
const SENTRY_ORG = process.env.NEXT_PUBLIC_SENTRY_ORG
|
||||
const SENTRY_PROJECT = process.env.NEXT_PUBLIC_SENTRY_PROJECT
|
||||
const isHideSentry = isDevelopment || !SENTRY_DSN || !SENTRY_ORG || !SENTRY_PROJECT
|
||||
|
||||
const withMDX = require('@next/mdx')({
|
||||
extension: /\.mdx?$/,
|
||||
options: {
|
||||
@@ -46,25 +38,6 @@ const nextConfig = {
|
||||
},
|
||||
]
|
||||
},
|
||||
...(isHideSentry
|
||||
? {}
|
||||
: {
|
||||
sentry: {
|
||||
hideSourceMaps: true,
|
||||
},
|
||||
}),
|
||||
}
|
||||
|
||||
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup
|
||||
const sentryWebpackPluginOptions = {
|
||||
org: SENTRY_ORG,
|
||||
project: SENTRY_PROJECT,
|
||||
silent: true, // Suppresses all logs
|
||||
sourcemaps: {
|
||||
assets: './**',
|
||||
ignore: ['./node_modules/**'],
|
||||
},
|
||||
// https://github.com/getsentry/sentry-webpack-plugin#options.
|
||||
}
|
||||
|
||||
module.exports = isHideSentry ? withMDX(nextConfig) : withMDX(withSentryConfig(nextConfig, sentryWebpackPluginOptions))
|
||||
module.exports = withMDX(nextConfig)
|
||||
|
||||
Reference in New Issue
Block a user