@@ -5,17 +5,39 @@ import { createMDX } from 'fumadocs-mdx/next'
55
66const withFumadocsMDX = createMDX ( )
77
8+ const enableSentry =
9+ Boolean ( process . env . NEXT_PUBLIC_SENTRY_DSN ) &&
10+ Boolean ( process . env . SENTRY_AUTH_TOKEN ) &&
11+ [ 'production' , 'preview' ] . includes ( process . env . VERCEL_ENV ?? '' )
12+
813/** @type {import('next').NextConfig } */
914const config = {
1015 outputFileTracingIncludes : {
1116 '/playground/pagination' : [
12- './src/app/playground/(demos)/pagination/searchParams .ts' ,
17+ './src/app/playground/(demos)/pagination/search-params .ts' ,
1318 './src/app/playground/(demos)/pagination/page.tsx' ,
1419 './src/app/playground/(demos)/pagination/pagination-controls.server.tsx' ,
1520 './src/app/playground/(demos)/pagination/pagination-controls.client.tsx'
1621 ]
1722 } ,
23+ reactCompiler : true ,
24+ cacheComponents : true ,
1825 reactStrictMode : true ,
26+ cacheLife : {
27+ static : {
28+ // Only changes on new deploys, assuming we at least deploy once a year
29+ stale : 300 , // 5 minutes for the client cache
30+ revalidate : 365 * 24 * 60 * 60 , // 1 year
31+ expire : 366 * 24 * 60 * 60 // 1 year + 1 day (has to be greater than revalidate)
32+ }
33+ } ,
34+ turbopack : {
35+ debugIds : enableSentry
36+ } ,
37+ experimental : {
38+ isolatedDevBuild : true
39+ } ,
40+ productionBrowserSourceMaps : enableSentry ,
1941 redirects : async ( ) => {
2042 return [
2143 {
@@ -65,45 +87,52 @@ const config = {
6587 }
6688}
6789
90+ /**
91+ * @type {import('@sentry/nextjs').SentryBuildOptions }
92+ */
6893const sentryConfig = {
6994 // For all available options, see:
7095 // https://github.com/getsentry/sentry-webpack-plugin#options
7196
72- // Suppresses source map uploading logs during build
7397 silent : true ,
7498 org : process . env . SENTRY_ORG ,
7599 project : process . env . SENTRY_PROJECT ,
76- authToken : process . env . SENTRY_AUTH_TOKEN
77- }
78-
79- const sentryOptions = {
80- // For all available options, see:
81- // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
100+ authToken : process . env . SENTRY_AUTH_TOKEN ,
82101
83102 // Upload a larger set of source maps for prettier stack traces (increases build time)
84- widenClientFileUpload : false ,
103+ widenClientFileUpload : true ,
85104
86- // Transpiles SDK to be compatible with IE11 (increases bundle size)
87- transpileClientSDK : false ,
105+ release : {
106+ setCommits : process . env . VERCEL_GIT_COMMIT_SHA
107+ ? {
108+ // https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/443#issuecomment-1815988709
109+ repo : '47ng/nuqs' ,
110+ commit : process . env . VERCEL_GIT_COMMIT_SHA
111+ }
112+ : { auto : true }
113+ } ,
88114
89115 // Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers. (increases server load)
90116 // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
91117 // side errors will fail.
92118 // tunnelRoute: '/sentry',
93119
94- hideSourceMaps : false ,
95-
96120 // Automatically tree-shake Sentry logger statements to reduce bundle size
97- disableLogger : true ,
121+ // disableLogger: true,
98122
99123 // Enables automatic instrumentation of Vercel Cron Monitors.
100124 // See the following for more information:
101125 // https://docs.sentry.io/product/crons/
102126 // https://vercel.com/docs/cron-jobs
103- automaticVercelMonitors : true
127+ automaticVercelMonitors : true ,
128+
129+ debug : false
130+ }
131+
132+ if ( enableSentry ) {
133+ console . info ( 'Sentry is enabled for this build.' )
104134}
105135
106- export default withSentryConfig ( withFumadocsMDX ( config ) , {
107- ...sentryConfig ,
108- ...sentryOptions
109- } )
136+ export default enableSentry
137+ ? withSentryConfig ( withFumadocsMDX ( config ) , sentryConfig )
138+ : withFumadocsMDX ( config )
0 commit comments