| const { withSentryConfig } = require('@sentry/nextjs') | const { withSentryConfig } = require('@sentry/nextjs') | ||||
| const EDITION = process.env.NEXT_PUBLIC_EDITION | |||||
| const IS_CE_EDITION = EDITION === 'SELF_HOSTED' | |||||
| const isDevelopment = process.env.NODE_ENV === 'development' | |||||
| const isHideSentry = isDevelopment || IS_CE_EDITION | |||||
| const withMDX = require('@next/mdx')({ | const withMDX = require('@next/mdx')({ | ||||
| extension: /\.mdx?$/, | extension: /\.mdx?$/, | ||||
| options: { | options: { | ||||
| // https://nextjs.org/docs/api-reference/next.config.js/ignoring-typescript-errors | // https://nextjs.org/docs/api-reference/next.config.js/ignoring-typescript-errors | ||||
| ignoreBuildErrors: true, | ignoreBuildErrors: true, | ||||
| }, | }, | ||||
| sentry: { | |||||
| hideSourceMaps: true, | |||||
| }, | |||||
| async redirects() { | async redirects() { | ||||
| return [ | return [ | ||||
| { | { | ||||
| }, | }, | ||||
| ] | ] | ||||
| }, | }, | ||||
| ...(isHideSentry | |||||
| ? {} | |||||
| : { | |||||
| sentry: { | |||||
| hideSourceMaps: true, | |||||
| }, | |||||
| }), | |||||
| } | } | ||||
| // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup | // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup | ||||
| assets: './**', | assets: './**', | ||||
| ignore: ['./node_modules/**'], | ignore: ['./node_modules/**'], | ||||
| }, | }, | ||||
| // https://github.com/getsentry/sentry-webpack-plugin#options. | // https://github.com/getsentry/sentry-webpack-plugin#options. | ||||
| } | } | ||||
| module.exports = withMDX(withSentryConfig(nextConfig, sentryWebpackPluginOptions)) | |||||
| module.exports = isHideSentry ? withMDX(nextConfig) : withMDX(withSentryConfig(nextConfig, sentryWebpackPluginOptions)) |