@@ -22,6 +22,7 @@ export type ExportedNextConfig = NextConfigObjectWithSentry | NextConfigFunction
2222export type NextConfigObjectWithSentry = NextConfigObject & {
2323 sentry ?: UserSentryOptions ;
2424} ;
25+
2526export type NextConfigFunctionWithSentry = (
2627 phase : string ,
2728 defaults : { defaultConfig : NextConfigObject } ,
@@ -60,39 +61,67 @@ export type NextConfigObject = {
6061} ;
6162
6263export type UserSentryOptions = {
63- // Override the SDK's default decision about whether or not to enable to the webpack plugin. Note that `false` forces
64- // the plugin to be enabled, even in situations where it's not recommended.
64+ /**
65+ * Override the SDK's default decision about whether or not to enable to the Sentry webpack plugin for server files.
66+ * Note that `false` forces the plugin to be enabled, even in situations where it's not recommended.
67+ */
6568 disableServerWebpackPlugin ?: boolean ;
69+
70+ /**
71+ * Override the SDK's default decision about whether or not to enable to the Sentry webpack plugin for client files.
72+ * Note that `false` forces the plugin to be enabled, even in situations where it's not recommended.
73+ */
6674 disableClientWebpackPlugin ?: boolean ;
6775
68- // Use `hidden-source-map` for webpack `devtool` option, which strips the `sourceMappingURL` from the bottom of built
69- // JS files
76+ /**
77+ * Use `hidden-source-map` for webpack `devtool` option, which strips the `sourceMappingURL` from the bottom of built
78+ * JS files.
79+ */
7080 hideSourceMaps ?: boolean ;
7181
72- // Force webpack to apply the same transpilation rules to the SDK code as apply to user code. Helpful when targeting
73- // older browsers which don't support ES6 (or ES6+ features like object spread).
82+ /**
83+ * Instructs webpack to apply the same transpilation rules to the SDK code as apply to user code. Helpful when
84+ * targeting older browsers which don't support ES6 (or ES6+ features like object spread).
85+ */
7486 transpileClientSDK ?: boolean ;
7587
76- // Upload files from `<distDir>/static/chunks` rather than `<distDir>/static/chunks/pages`. Usually files outside of
77- // `pages/` only contain third-party code, but in cases where they contain user code, restricting the webpack
78- // plugin's upload breaks sourcemaps for those user-code-containing files, because it keeps them from being
79- // uploaded. At the same time, we don't want to widen the scope if we don't have to, because we're guaranteed to end
80- // up uploading too many files, which is why this defaults to `false`.
88+ /**
89+ * Instructs the Sentry webpack plugin to upload source files from `<distDir>/static/chunks` rather than
90+ * `<distDir>/static/chunks/pages`. Usually files outside of `pages/` only contain third-party code, but in cases
91+ * where they contain user code, restricting the webpack plugin's upload breaks sourcemaps for those
92+ * user-code-containing files, because it keeps them from being uploaded. Defaults to `false`.
93+ */
94+ // We don't want to widen the scope if we don't have to, because we're guaranteed to end up uploading too many files,
95+ // which is why this defaults to`false`.
8196 widenClientFileUpload ?: boolean ;
8297
83- // Automatically instrument Next.js data fetching methods and Next.js API routes
98+ /**
99+ * Automatically instrument Next.js data fetching methods and Next.js API routes with error and performance monitoring.
100+ * Defaults to `true`.
101+ */
84102 autoInstrumentServerFunctions ?: boolean ;
85103
86- // Exclude certain serverside API routes or pages from being instrumented with Sentry. This option takes an array of
87- // strings or regular expressions.
88- //
89- // NOTE: Pages should be specified as routes (`/animals` or `/api/animals/[animalType]/habitat`), not filepaths
90- // (`pages/animals/index.js` or `.\src\pages\api\animals\[animalType]\habitat.tsx`), and strings must be be a full,
91- // exact match.
104+ /**
105+ * Automatically instrument Next.js middleware with error and performance monitoring. Defaults to `true`.
106+ */
107+ autoInstrumentMiddleware ?: boolean ;
108+
109+ /**
110+ * Exclude certain serverside API routes or pages from being instrumented with Sentry. This option takes an array of
111+ * strings or regular expressions.
112+ *
113+ * NOTE: Pages should be specified as routes (`/animals` or `/api/animals/[animalType]/habitat`), not filepaths
114+ * (`pages/animals/index.js` or `.\src\pages\api\animals\[animalType]\habitat.tsx`), and strings must be be a full,
115+ * exact match.
116+ */
92117 excludeServerRoutes ?: Array < RegExp | string > ;
93118
94- // Tunnel Sentry requests through this route on the Next.js server, to circumvent ad-blockers blocking Sentry events from being sent.
95- // This option should be a path (for example: '/error-monitoring').
119+ /**
120+ * Tunnel Sentry requests through this route on the Next.js server, to circumvent ad-blockers blocking Sentry events
121+ * from being sent. This option should be a path (for example: '/error-monitoring').
122+ *
123+ * NOTE: This feature only works with Next.js 11+
124+ */
96125 tunnelRoute ?: string ;
97126} ;
98127
@@ -164,7 +193,7 @@ export type EntryPointObject = { import: string | Array<string> };
164193 */
165194
166195export type WebpackModuleRule = {
167- test ?: string | RegExp ;
196+ test ?: string | RegExp | ( ( resourcePath : string ) => boolean ) ;
168197 include ?: Array < string | RegExp > | RegExp ;
169198 exclude ?: ( filepath : string ) => boolean ;
170199 use ?: ModuleRuleUseProperty | Array < ModuleRuleUseProperty > ;
0 commit comments