Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(react-component-annotate): Allow skipping annotations on specified components #617

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

0Calories
Copy link
Member

@0Calories 0Calories commented Oct 8, 2024

Some third party libraries involve components that have compatibility issues with the react-component-annotate plugin, and results in errors when the data-sentry properties are added as props. This PR introduces a bit of a bandaid fix by introducing an option to allow users to configure the names of components that should not have any annotations applied.

When using the standalone Babel plugin, you can configure this option like so:

// babel.config.js

{
  // ... other config above ...

  plugins: [
    // Put this plugin before any other plugins you have that transform JSX code
    // The options are set by providing an object as the second element in the array, but not required
    ['@sentry/babel-plugin-component-annotate', {ignoreComponents: ['Foo', 'Bar']}]
  ],
}

When using the Sentry bundler plugins, you can configure this option like so:

sentryVitePlugin({
    // ... other options
    reactComponentAnnotation: {enabled: true, ignoreComponents: ['Foo', 'Bar']},
}),

TODO: Add tests and allow providing a source file location, since it is possible for multiple components to have the same name, but you may not want to skip annotation on all of these.

@0Calories 0Calories self-assigned this Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant