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(astro): Accept all vite-plugin options #15638

Merged
merged 3 commits into from
Mar 13, 2025

Conversation

angelikatyborska
Copy link
Contributor

Adds support for unstable_sentryVitePluginOptions which can be used to pass any valid vite-plugin option.

Fixes #15601

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).

Hello 👋 this is my first ever contribution in this repository. I hope I understood and followed all the contribution guides correctly. Please let me know if I need to fix something, add more tests, refactor something. Or feel free to push more commits yourself - whichever working style you prefer!

I tried to base my implementation of this feature for sentry/astro on the existing implementation for sentry/sveltekit, from where I copied for example the type comment.

Sorry, something went wrong.

Adds support for `unstable_sentryVitePluginOptions` which can be used
to pass any valid vite-plugin option.

Fixes getsentry#15601
Copy link
Member

@lforst lforst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! We should address the one comment I left!

@@ -85,6 +85,7 @@ export const sentryAstro = (options: SentryOptions = {}): AstroIntegration => {
},
},
debug: options.debug ?? false,
...unstable_sentryVitePluginOptions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory we need to spread this into all of the sub-options to be correct. Similar to how we do it here:

...sentryBuildOptions.unstable_sentryWebpackPluginOptions?.reactComponentAnnotation,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: 15198e3 (#15638)

Btw. I'm not sure if the nextjs package spreads into sub-options correctly. It looks to me like at the end, it overwrites them anyway:

...sentryBuildOptions.unstable_sentryWebpackPluginOptions,

It looks like there is no test that would test a scenario with unstable_sentryWebpackPluginOptions set 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I think you're right. Thanks for catching that. I'll fix that in a follow-up 👍

@lforst lforst self-assigned this Mar 12, 2025
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for contributing this!

@Lms24 Lms24 merged commit 9cb8684 into getsentry:develop Mar 13, 2025
30 checks passed
Lms24 added a commit that referenced this pull request Mar 13, 2025
This PR adds the external contributor to the CHANGELOG.md file, so that
they are credited for their contribution. See #15638

Co-authored-by: Lms24 <8420481+Lms24@users.noreply.github.com>
@s1gr1d
Copy link
Member

s1gr1d commented Mar 17, 2025

@angelikatyborska Thanks for contributing this! :)
If you want, you can adapt the code snippet in the docs as well - like it was done here: getsentry/sentry-docs#12940

It's for the code snippet in the thirdPartyErrorFilterIntegration: https://docs.sentry.io/platforms/javascript/guides/astro/configuration/filtering/#using-thirdpartyerrorfilterintegration

@angelikatyborska
Copy link
Contributor Author

I opened a PR for the docs: getsentry/sentry-docs#13035

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.

[Astro] Add unstable_sentryVitePluginOptions
4 participants