File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 11import { configureScope , init as reactInit } from '@sentry/react' ;
2+ import { Integrations } from '@sentry/tracing' ;
23
4+ import { nextRouterInstrumentation } from './performance/client' ;
35import { MetadataBuilder } from './utils/metadataBuilder' ;
46import { NextjsOptions } from './utils/nextjsOptions' ;
7+ import { addIntegration } from './utils/userIntegrations' ;
58
69export * from '@sentry/react' ;
710export { nextRouterInstrumentation } from './performance/client' ;
@@ -11,8 +14,21 @@ export function init(options: NextjsOptions): void {
1114 const metadataBuilder = new MetadataBuilder ( options , [ 'nextjs' , 'react' ] ) ;
1215 metadataBuilder . addSdkMetadata ( ) ;
1316 options . environment = options . environment || process . env . NODE_ENV ;
17+ addClientIntegrations ( options ) ;
1418 reactInit ( options ) ;
1519 configureScope ( scope => {
1620 scope . setTag ( 'runtime' , 'browser' ) ;
1721 } ) ;
1822}
23+
24+ const defaultBrowserTracingIntegration = new Integrations . BrowserTracing ( {
25+ routingInstrumentation : nextRouterInstrumentation ,
26+ } ) ;
27+
28+ function addClientIntegrations ( options : NextjsOptions ) : void {
29+ if ( options . integrations ) {
30+ addIntegration ( defaultBrowserTracingIntegration , options . integrations ) ;
31+ } else {
32+ options . integrations = [ defaultBrowserTracingIntegration ] ;
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments