diff --git a/docs/platforms/javascript/guides/nextjs/configuration/build/index.mdx b/docs/platforms/javascript/guides/nextjs/configuration/build/index.mdx index 64d59a2ae9013..62bc8e04c24a3 100644 --- a/docs/platforms/javascript/guides/nextjs/configuration/build/index.mdx +++ b/docs/platforms/javascript/guides/nextjs/configuration/build/index.mdx @@ -182,25 +182,72 @@ Note: Enabling this option can lead to longer build times. - + + +This feature requires **Next.js version 11+** and doesn't currently work with self-hosted Sentry instances. + + +Tunnel Sentry requests through this route on your Next.js server to prevent ad-blockers from blocking Sentry events from being sent. + +This option can be set to: + +- `true` for auto-generated routes, which are unpredictable and change with each deployment. +- A custom static string path like `/error-monitoring`. + +Learn more about tunneling in the troubleshooting section. + + + If you're using Turbopack, client-side event recording will fail if your + Next.js middleware intercepts the configured tunnel route. To fix this, set + the route to a fixed string (like `/error-monitoring`) and add a negative + matcher like `(?!error-monitoring)` in your middleware to exclude the tunnel + route. If you're not using Turbopack, Sentry will automatically skip the + tunnel route in your middleware. + + + + + + + + You can use this option with Next.js version 15.4.1 and later. + + +Enables the use of the [`runAfterProductionCompile` hook from Next.js](https://nextjs.org/docs/architecture/nextjs-compiler#runafterproductioncompile) to upload sourcemaps after the build is completed. + +- This option is set to `true` by default for Turbopack as there are no alternative ways to upload sourcemaps here. +- This option is set to `false` for Webpack as the default behavior is to upload sourcemaps during the build process using the [Sentry Webpack Plugin](https://github.com/getsentry/sentry-javascript-bundler-plugins). + +**Important:** Enabling this option will mutate your Next.js build output by injecting [Debug IDs](/platforms/javascript/guides/nextjs/sourcemaps/troubleshooting_js/debug-ids/) via the Sentry CLI. If you are relying on any sort of integrity hashes for your build artifacts, you will need to disable this option. + + + +## Next.js Webpack Options + + + These options only take effect if you're using Webpack. If you're using + Turbopack, these options will have no effect. + + + Automatically instrument Next.js data fetching methods and Next.js API routes with error and performance monitoring. - + Automatically instrument Next.js middleware with error and performance monitoring. - + Automatically instrument components in the `app` directory with error monitoring. - + Exclude specific server-side API routes or pages from automatic Sentry instrumentation during build time. This option takes an array of strings or regular expressions and affects pages in the `pages` and `app` directories. @@ -226,35 +273,25 @@ excludeServerRoutes: [ - - -This feature requires **Next.js version 11+** and doesn't currently work with self-hosted Sentry instances. - - -Tunnel Sentry requests through this route on your Next.js server to prevent ad-blockers from blocking Sentry events from being sent. + -This option can be set to: - -- `true` for auto-generated routes, which are unpredictable and change with each deployment. -- A custom static string path like `/error-monitoring`. - -Learn more about tunneling in the troubleshooting section. - - - If you're using Turbopack, client-side event recording will fail if your - Next.js middleware intercepts the configured tunnel route. To fix this, set - the route to a fixed string (like `/error-monitoring`) and add a negative - matcher like `(?!error-monitoring)` in your middleware to exclude the tunnel - route. If you're not using Turbopack, Sentry will automatically skip the - tunnel route in your middleware. - +Automatically create cron monitors in Sentry for your Vercel Cron Jobs if configured via `vercel.json`. - - -Automatically create cron monitors in Sentry for your Vercel Cron Jobs if configured via `vercel.json`. - + + Pass configuration options directly to the [Sentry Webpack + Plugin](https://www.npmjs.com/package/@sentry/webpack-plugin) that ships with + the Sentry Next.js SDK. If `withSentryConfig` doesn't provide the option you + need to modify, you may override the `sentryWebpackPluginOptions` using this + option. + + This option is considered unstable, and its API may change in a breaking way + in any release. + @@ -272,46 +309,14 @@ The route manifest is a build-time generated mapping of your Next.js App Router - + Enables React component name tracking. When enabled, it annotates React components with data attributes that allow Sentry to track which components users interacted with in features like Session Replay and breadcrumbs. - + A list of React component names to exclude from component annotation. - - - - - You can use this option with Next.js version 15.4.1 and later. - - -Enables the use of the [`runAfterProductionCompile` hook from Next.js](https://nextjs.org/docs/architecture/nextjs-compiler#runafterproductioncompile) to upload sourcemaps after the build is completed. - -- This option is set to `true` by default for Turbopack as there are no alternative ways to upload sourcemaps here. -- This option is set to `false` for Webpack as the default behavior is to upload sourcemaps during the build process using the [Sentry Webpack Plugin](https://github.com/getsentry/sentry-javascript-bundler-plugins). - -**Important:** Enabling this option will mutate your Next.js build output by injecting [Debug IDs](/platforms/javascript/guides/nextjs/sourcemaps/troubleshooting_js/debug-ids/) via the Sentry CLI. If you are relying on any sort of integrity hashes for your build artifacts, you will need to disable this option. - - - - - - - Pass configuration options directly to the [Sentry Webpack - Plugin](https://www.npmjs.com/package/@sentry/webpack-plugin) that ships with - the Sentry Next.js SDK. If `withSentryConfig` doesn't provide the option you - need to modify, you may override the `sentryWebpackPluginOptions` using this - option. - - This option is considered unstable, and its API may change in a breaking way - in any release. - -