@@ -5,7 +5,7 @@ import createNextIntlPlugin from 'next-intl/plugin';
5
5
import './src/libs/Env' ;
6
6
7
7
// Define the base Next.js configuration
8
- let nextConfig : NextConfig = {
8
+ const baseConfig : NextConfig = {
9
9
eslint : {
10
10
dirs : [ '.' ] ,
11
11
} ,
@@ -15,55 +15,49 @@ let nextConfig: NextConfig = {
15
15
} ;
16
16
17
17
// Initialize the Next-Intl plugin
18
- nextConfig = createNextIntlPlugin ( './src/libs/i18n.ts' ) ( nextConfig ) ;
18
+ let configWithPlugins = createNextIntlPlugin ( './src/libs/i18n.ts' ) ( baseConfig ) ;
19
19
20
20
// Conditionally enable bundle analysis
21
21
if ( process . env . ANALYZE === 'true' ) {
22
- nextConfig = withBundleAnalyzer ( ) ( nextConfig ) ;
22
+ configWithPlugins = withBundleAnalyzer ( ) ( configWithPlugins ) ;
23
23
}
24
24
25
- // Sentry configuration
26
- const sentryOptions = {
27
- // For all available options, see:
28
- // https://github.com/getsentry/sentry-webpack-plugin#options
29
- // FIXME: Add your Sentry organization and project names
30
- org : 'nextjs-boilerplate-org' ,
31
- project : 'nextjs-boilerplate' ,
32
-
33
- // Only print logs for uploading source maps in CI
34
- silent : ! process . env . CI ,
35
-
36
- // For all available options, see:
37
- // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
38
-
39
- // Upload a larger set of source maps for prettier stack traces (increases build time)
40
- widenClientFileUpload : true ,
41
-
42
- // Automatically annotate React components to show their full name in breadcrumbs and session replay
43
- reactComponentAnnotation : {
44
- enabled : true ,
45
- } ,
46
-
47
- // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
48
- // This can increase your server load as well as your hosting bill.
49
- // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
50
- // side errors will fail.
51
- tunnelRoute : '/monitoring' ,
52
-
53
- // Hides source maps from generated client bundles
54
- hideSourceMaps : true ,
55
-
56
- // Automatically tree-shake Sentry logger statements to reduce bundle size
57
- disableLogger : true ,
58
-
59
- // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
60
- // See the following for more information:
61
- // https://docs.sentry.io/product/crons/
62
- // https://vercel.com/docs/cron-jobs
63
- automaticVercelMonitors : true ,
64
-
65
- // Disable Sentry telemetry
66
- telemetry : false ,
67
- } ;
25
+ // Conditionally enable Sentry configuration
26
+ if ( ! process . env . NEXT_PUBLIC_SENTRY_DISABLED ) {
27
+ configWithPlugins = withSentryConfig ( configWithPlugins , {
28
+ // For all available options, see:
29
+ // https://www.npmjs.com/package/@sentry /webpack-plugin#options
30
+ // FIXME: Add your Sentry organization and project names
31
+ org : 'nextjs-boilerplate-org' ,
32
+ project : 'nextjs-boilerplate' ,
33
+
34
+ // Only print logs for uploading source maps in CI
35
+ silent : ! process . env . CI ,
36
+
37
+ // For all available options, see:
38
+ // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
39
+
40
+ // Upload a larger set of source maps for prettier stack traces (increases build time)
41
+ widenClientFileUpload : true ,
42
+
43
+ // Upload a larger set of source maps for prettier stack traces (increases build time)
44
+ reactComponentAnnotation : {
45
+ enabled : true ,
46
+ } ,
47
+
48
+ // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
49
+ // This can increase your server load as well as your hosting bill.
50
+ // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
51
+ // side errors will fail.
52
+ tunnelRoute : '/monitoring' ,
53
+
54
+ // Automatically tree-shake Sentry logger statements to reduce bundle size
55
+ disableLogger : true ,
56
+
57
+ // Disable Sentry telemetry
58
+ telemetry : false ,
59
+ } ) ;
60
+ }
68
61
69
- export default withSentryConfig ( nextConfig , sentryOptions ) ;
62
+ const nextConfig = configWithPlugins ;
63
+ export default nextConfig ;
0 commit comments