feat: use react sentry to support pass config via runtime (#350)
This commit is contained in:
parent
a11f36ca60
commit
fff39a307a
10 changed files with 27 additions and 83 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue