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(sveltekit): Add Sentry Vite Plugin to upload source maps #7811

Merged
merged 4 commits into from Apr 12, 2023

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Apr 11, 2023

This PR adds a customized version of the Sentry Vite plugin to the SvelteKit SDK.

After realizing that the proposed API in #7787 doesn't work as I originally thought, this PR also re-reworks it a little bit:

  • Instead of having a super plugin that adds our other plugins (this doesn't work), we now export a factory function that returns an array of plugins. SvelteKit also creates its plugins this way.
  • The currently only plugin in this array is the customized Vite plugin.

The customized Vite plugin differs from the Vite plugin as follows:

  • It only runs on builds (not on the dev server)
  • It tries to run as late as possible by setting enforce: 'post'
  • It uses the closeBundle hook instead of the writeBundle hook to upload source maps.
    • This is because the SvelteKit adapters also run only at closeBundle but luckily before our plugin
  • It uses the configure hook to enable source map generation
  • It flattens source maps before uploading them

Also:

image

ref #7669

@Lms24 Lms24 requested review from lforst and AbhiPrasad April 11, 2023 16:14
@Lms24 Lms24 self-assigned this Apr 11, 2023
packages/sveltekit/README.md Outdated Show resolved Hide resolved
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.

None yet

3 participants