File tree Expand file tree Collapse file tree 5 files changed +43
-1
lines changed
Expand file tree Collapse file tree 5 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -2,3 +2,4 @@ export * from '@sentry/vue';
22
33export { init } from './sdk' ;
44export { piniaIntegration } from './piniaIntegration' ;
5+ export { vueIntegration } from './vueIntegration' ;
Original file line number Diff line number Diff line change 1+ import { defineIntegration } from '@sentry/core' ;
2+ import type { VueIntegrationOptions } from '@sentry/vue' ;
3+
4+ type Options = Omit <
5+ VueIntegrationOptions ,
6+ | 'app'
7+ | 'Vue'
8+ // TODO(v9): Should be removed from parent type so we can remove it here
9+ | 'hooks'
10+ // TODO(v9): Should be removed from parent type so we can remove it here
11+ | 'timeout'
12+ // TODO(v9): Should be removed from parent type so we can remove it here
13+ | 'trackComponents'
14+ > ;
15+
16+ let nuxtVueIntegrationOptions : Options | undefined ;
17+
18+ export const vueIntegration = defineIntegration ( ( options : Options = { } ) => {
19+ nuxtVueIntegrationOptions = options ;
20+ return {
21+ name : 'NuxtVueIntegration' ,
22+ } ;
23+ } ) ;
24+
25+ /**
26+ * The vueIntegration exported by the Nuxt SDK does nothing besides storing it's options to the side so we can later pick them up when we add the actual vueIntegration.
27+ * This function allows us to pick up the options.
28+ */
29+ export function retrieveNuxtVueIntegrationOptions ( ) : Options | undefined {
30+ return nuxtVueIntegrationOptions ;
31+ }
Original file line number Diff line number Diff line change 11import { getClient } from '@sentry/core' ;
22import { browserTracingIntegration , vueIntegration } from '@sentry/vue' ;
33import { defineNuxtPlugin } from 'nuxt/app' ;
4+ import { retrieveNuxtVueIntegrationOptions } from '../../client/vueIntegration' ;
45import { reportNuxtError } from '../utils' ;
56
67// --- Types are copied from @sentry/vue (so it does not need to be exported) ---
@@ -53,7 +54,13 @@ export default defineNuxtPlugin({
5354 // Adding the Vue integration without the Vue error handler
5455 // Nuxt is registering their own error handler, which is unset after hydration: https://github.com/nuxt/nuxt/blob/d3fdbcaac6cf66d21e25d259390d7824696f1a87/packages/nuxt/src/app/entry.ts#L64-L73
5556 // We don't want to wrap the existing error handler, as it leads to a 500 error: https://github.com/getsentry/sentry-javascript/issues/12515
56- sentryClient . addIntegration ( vueIntegration ( { app : vueApp , attachErrorHandler : false } ) ) ;
57+ sentryClient . addIntegration (
58+ vueIntegration ( {
59+ ...retrieveNuxtVueIntegrationOptions ( ) ,
60+ app : vueApp ,
61+ attachErrorHandler : false ,
62+ } ) ,
63+ ) ;
5764 }
5865 } ) ;
5966
Original file line number Diff line number Diff line change @@ -5,4 +5,5 @@ export { browserTracingIntegration } from './browserTracingIntegration';
55export { attachErrorHandler } from './errorhandler' ;
66export { createTracingMixins } from './tracing' ;
77export { vueIntegration } from './integration' ;
8+ export type { VueIntegrationOptions } from './integration' ;
89export { createSentryPiniaPlugin } from './pinia' ;
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ const DEFAULT_CONFIG: VueOptions = {
1919
2020const INTEGRATION_NAME = 'Vue' ;
2121
22+ export type VueIntegrationOptions = Partial < VueOptions > ;
23+
2224export const vueIntegration = defineIntegration ( ( integrationOptions : Partial < VueOptions > = { } ) => {
2325 return {
2426 name : INTEGRATION_NAME ,
You can’t perform that action at this time.
0 commit comments