@@ -29,7 +29,10 @@ import { fileDeletionPlugin } from "./plugins/sourcemap-deletion";
29
29
30
30
interface SentryUnpluginFactoryOptions {
31
31
releaseInjectionPlugin : ( injectionCode : string ) => UnpluginOptions ;
32
- componentNameAnnotatePlugin ?: ( ) => UnpluginOptions ;
32
+ componentNameAnnotatePlugin ?: (
33
+ ignoredFiles ?: string [ ] ,
34
+ ignoredComponents ?: string [ ]
35
+ ) => UnpluginOptions ;
33
36
moduleMetadataInjectionPlugin : ( injectionCode : string ) => UnpluginOptions ;
34
37
debugIdInjectionPlugin : ( logger : Logger ) => UnpluginOptions ;
35
38
debugIdUploadPlugin : ( upload : ( buildArtifacts : string [ ] ) => Promise < void > ) => UnpluginOptions ;
@@ -399,7 +402,13 @@ export function sentryUnpluginFactory({
399
402
"The component name annotate plugin is currently not supported by '@sentry/esbuild-plugin'"
400
403
) ;
401
404
} else {
402
- componentNameAnnotatePlugin && plugins . push ( componentNameAnnotatePlugin ( ) ) ;
405
+ componentNameAnnotatePlugin &&
406
+ plugins . push (
407
+ componentNameAnnotatePlugin (
408
+ options . reactComponentAnnotation . ignoredFiles ,
409
+ options . reactComponentAnnotation . ignoredComponents
410
+ )
411
+ ) ;
403
412
}
404
413
}
405
414
@@ -627,14 +636,19 @@ export function createComponentNameAnnotateHooks(
627
636
return null ;
628
637
}
629
638
630
- const isIgnoredFile = ignoredFiles ?. some ( ( file ) => idWithoutQueryAndHash . endsWith ( file ) ) ;
631
- if ( isIgnoredFile ) {
632
- console . log ( `FOUND IGNORED FILE: ${ idWithoutQueryAndHash } ` ) ;
639
+ // We will only apply this plugin on jsx and tsx files
640
+ if ( ! [ ".jsx" , ".tsx" ] . some ( ( ending ) => idWithoutQueryAndHash . endsWith ( ending ) ) ) {
633
641
return null ;
634
642
}
635
643
636
- // We will only apply this plugin on jsx and tsx files
637
- if ( ! [ ".jsx" , ".tsx" ] . some ( ( ending ) => idWithoutQueryAndHash . endsWith ( ending ) ) ) {
644
+ console . log ( "ignored files:" ) ;
645
+ console . dir ( ignoredFiles ) ;
646
+ console . log ( "current file:" ) ;
647
+ console . log ( idWithoutQueryAndHash ) ;
648
+
649
+ const isIgnoredFile = ignoredFiles ?. some ( ( file ) => idWithoutQueryAndHash . endsWith ( file ) ) ;
650
+ if ( isIgnoredFile ) {
651
+ console . log ( `FOUND IGNORED FILE: ${ idWithoutQueryAndHash } ` ) ;
638
652
return null ;
639
653
}
640
654
0 commit comments