Skip to content

Commit 353a0e0

Browse files
author
Luca Forstner
committed
feat: Ignore Fragment components by default for react component annotation
1 parent ee73414 commit 353a0e0

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

packages/bundler-plugin-core/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ export function sentryUnpluginFactory({
438438
if (options.reactComponentAnnotation) {
439439
if (!options.reactComponentAnnotation.enabled) {
440440
logger.debug(
441-
"The component name annotate plugin is currently disabled. Skipping component name annotations."
441+
"The component name annotate plugin is disabled. Skipping component name annotations."
442442
);
443443
} else if (options.reactComponentAnnotation.enabled && !componentNameAnnotatePlugin) {
444444
logger.warn(

packages/bundler-plugin-core/src/options-mapping.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ export type NormalizedOptions = ReturnType<typeof normalizeUserOptions>;
66

77
export const SENTRY_SAAS_URL = "https://sentry.io";
88

9+
const DEFAULT_IGNORED_REACT_COMPONENTS = ["Fragment"];
10+
911
export function normalizeUserOptions(userOptions: UserOptions) {
1012
const options = {
1113
org: userOptions.org ?? process.env["SENTRY_ORG"],
@@ -28,7 +30,17 @@ export function normalizeUserOptions(userOptions: UserOptions) {
2830
vcsRemote: userOptions.release?.vcsRemote ?? process.env["SENTRY_VSC_REMOTE"] ?? "origin",
2931
},
3032
bundleSizeOptimizations: userOptions.bundleSizeOptimizations,
31-
reactComponentAnnotation: userOptions.reactComponentAnnotation,
33+
reactComponentAnnotation: userOptions.reactComponentAnnotation
34+
? {
35+
enabled: userOptions.reactComponentAnnotation?.enabled ?? false,
36+
ignoredComponents: [
37+
...new Set([
38+
...(userOptions.reactComponentAnnotation?.ignoredComponents ?? []),
39+
...DEFAULT_IGNORED_REACT_COMPONENTS,
40+
]),
41+
],
42+
}
43+
: undefined,
3244
_metaOptions: {
3345
telemetry: {
3446
metaFramework: userOptions._metaOptions?.telemetry?.metaFramework,

0 commit comments

Comments
 (0)