File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed
packages/nextjs/src/config Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,10 @@ export type UserSentryOptions = {
4949 // 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
5050 // up uploading too many files, which is why this defaults to `false`.
5151 widenClientFileUpload ?: boolean ;
52+
53+ // Automatically wrap `getServerSideProps`, `getStaticProps`, and `getStaticPaths` in order to instrument them for
54+ // tracing.
55+ autoWrapDataFetchers ?: boolean ;
5256} ;
5357
5458export type NextConfigFunction = ( phase : string , defaults : { defaultConfig : NextConfigObject } ) => NextConfigObject ;
Original file line number Diff line number Diff line change @@ -74,17 +74,20 @@ export function constructWebpackConfigFunction(
7474 } ,
7575 ] ,
7676 } ,
77- {
78- test : pageRegex ,
79- use : [
80- {
81- loader : path . resolve ( __dirname , 'loaders/dataFetchersLoader.js' ) ,
82- options : { projectDir } ,
83- } ,
84- ] ,
85- } ,
8677 ] ,
8778 } ;
79+
80+ if ( userSentryOptions . autoWrapDataFetchers ) {
81+ newConfig . module . rules . push ( {
82+ test : pageRegex ,
83+ use : [
84+ {
85+ loader : path . resolve ( __dirname , 'loaders/dataFetchersLoader.js' ) ,
86+ options : { projectDir } ,
87+ } ,
88+ ] ,
89+ } ) ;
90+ }
8891 }
8992
9093 // The SDK uses syntax (ES6 and ES6+ features like object spread) which isn't supported by older browsers. For users
You can’t perform that action at this time.
0 commit comments