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: Support passing JavaScript framework specific SDK init as second init parameter #575

Merged
merged 3 commits into from
Oct 13, 2022

Conversation

timfish
Copy link
Collaborator

@timfish timfish commented Oct 13, 2022

This copies the approach used in @sentry/capacitor.

import * as Sentry from "@sentry/capacitor";
import { init as sentryAngularInit }  from "@sentry/angular";

// Init by passing the sibling SDK's init as the second parameter.
Sentry.init({
  dsn: "__DSN__",
}, sentryAngularInit);

This involves minimal code changes and is not a breaking change since to the 2nd parameter has a default of the browser init!

I've extended the react and vite example apps to use this approach.

Closes #506

Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

Great change! Reminder to also update the sentry docs!

// We replace the Sentry JavaScript dependency versions to match that of @sentry/electron
.replace(/"@sentry\/tracing": ".*"/, `"@sentry/tracing": "${JS_VERSION}"`)
.replace(/"@sentry\/react": ".*"/, `"@sentry/react": "${JS_VERSION}"`)
.replace(/"@sentry\/vue": ".*"/, `"@sentry/vue": "${JS_VERSION}"`);
Copy link
Member

Choose a reason for hiding this comment

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

there is also @sentry/svelte, @sentry/ember, and @sentry/angular!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indeed, although we don't have any example tests for those... yet 😁

I'm also aware that the examples don't actually tests the vue/react SDK functionality!

@timfish timfish merged commit ffad61d into getsentry:master Oct 13, 2022
@timfish timfish deleted the feat/support-framework-sdks branch October 26, 2022 14:16
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.

What is the right way to setup Sentry Electron SDK with Vite & Vue 3
2 participants