|
1 | 1 | import { getClient } from '@sentry/core'; |
2 | | -import { consoleSandbox } from '@sentry/utils'; |
3 | | -import { browserTracingIntegration, createSentryPiniaPlugin, vueIntegration } from '@sentry/vue'; |
| 2 | +import { browserTracingIntegration, vueIntegration } from '@sentry/vue'; |
4 | 3 | import { defineNuxtPlugin } from 'nuxt/app'; |
5 | 4 | import { reportNuxtError } from '../utils'; |
6 | 5 |
|
@@ -35,36 +34,18 @@ export default defineNuxtPlugin({ |
35 | 34 | name: 'sentry-client-integrations', |
36 | 35 | dependsOn: ['sentry-client-config'], |
37 | 36 | async setup(nuxtApp) { |
38 | | - const sentryClient = getClient(); |
39 | | - const clientOptions = sentryClient && sentryClient.getOptions(); |
40 | | - |
41 | 37 | // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with "false", in which case everything inside |
42 | 38 | // will get tree-shaken away |
43 | 39 | if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) { |
| 40 | + const sentryClient = getClient(); |
| 41 | + |
44 | 42 | if (sentryClient && '$router' in nuxtApp) { |
45 | 43 | sentryClient.addIntegration( |
46 | 44 | browserTracingIntegration({ router: nuxtApp.$router as VueRouter, routeLabel: 'path' }), |
47 | 45 | ); |
48 | 46 | } |
49 | 47 | } |
50 | 48 |
|
51 | | - if (clientOptions && 'trackPinia' in clientOptions && clientOptions.trackPinia) { |
52 | | - if ('$pinia' in nuxtApp) { |
53 | | - (nuxtApp.$pinia as { use: (plugin: unknown) => void }).use( |
54 | | - // `trackPinia` is an object with custom options or `true` (pass `undefined` to use default options) |
55 | | - createSentryPiniaPlugin(clientOptions.trackPinia === true ? undefined : clientOptions.trackPinia), |
56 | | - ); |
57 | | - } else { |
58 | | - clientOptions.debug && |
59 | | - consoleSandbox(() => { |
60 | | - // eslint-disable-next-line no-console |
61 | | - console.warn( |
62 | | - '[Sentry] You set `trackPinia`, but the Pinia module was not found. Make sure to add `"@pinia/nuxt"` to your modules array.', |
63 | | - ); |
64 | | - }); |
65 | | - } |
66 | | - } |
67 | | - |
68 | 49 | nuxtApp.hook('app:created', vueApp => { |
69 | 50 | const sentryClient = getClient(); |
70 | 51 |
|
|
0 commit comments