11/* eslint-disable import/order */
22import Vue from 'vue'
33import merge from '~lodash.mergewith'
4- import * as Sentry from '~@sentry/vue'
5- < % if ( options . tracing ) { % > import { BrowserTracing } from '~@sentry/tracing' < % } % >
64< %
7- if ( options . initialize ) {
8- let integrations = options . BROWSER_PLUGGABLE_INTEGRATIONS . filter ( key => key in options . integrations )
9- if ( integrations . length ) { % > import { < %= integrations . join ( ', ' ) % > } from '~@sentry/integrations'
5+ const vueImports = [ 'getCurrentHub' , 'init' , 'Integrations' , ...( options . tracing ? [ 'vueRouterInstrumentation' ] : [ ] ) ]
6+ % > import { < %= vueImports . join ( ', ' ) % > } from '~@sentry/vue'
7+ < %
8+ if ( options . tracing ) { % > import { BrowserTracing } from '~@sentry/tracing'
109< % }
11- if ( options . clientConfigPath ) { % > import getClientConfig from '<%= options.clientConfigPath %>'
10+ let integrations = options . BROWSER_PLUGGABLE_INTEGRATIONS . filter ( key => key in options . integrations )
11+ if ( integrations . length ) { % > import { < %= integrations . join ( ', ' ) % > } from '~@sentry/integrations'
1212< % }
13- if ( options . customClientIntegrations ) { % > import getCustomIntegrations from '<%= options.customClientIntegrations %>'
13+ if ( options . clientConfigPath ) { % > import getClientConfig from '<%= options.clientConfigPath %>'
1414< % }
15- integrations = options . BROWSER_INTEGRATIONS . filter ( key => key in options . integrations )
16- if ( integrations . length ) { % >
17- const { < %= integrations . join ( ', ' ) % > } = Sentry . Integrations
15+ if ( options . customClientIntegrations ) { % > import getCustomIntegrations from '<%= options.customClientIntegrations %>'
16+ < % }
17+ integrations = options . BROWSER_INTEGRATIONS . filter ( key => key in options . integrations )
18+ if ( integrations . length ) { % >
19+ const { < %= integrations . join ( ', ' ) % > } = Integrations
1820< % }
19- }
2021% >
2122
2223export default async function ( ctx , inject ) {
23- < % if ( options . initialize ) { % >
2424 /* eslint-disable object-curly-spacing, quote-props, quotes, key-spacing, comma-spacing */
2525 const config = {
2626 Vue,
@@ -53,7 +53,7 @@ export default async function (ctx, inject) {
5353 // eslint-disable-next-line prefer-regex-literals
5454 const { browserTracing, vueOptions, ...tracingOptions } = < %= serialize ( options . tracing ) % >
5555 config . integrations . push ( new BrowserTracing ( {
56- ...( ctx . app . router ? { routingInstrumentation : Sentry . vueRouterInstrumentation ( ctx . app . router ) } : { } ) ,
56+ ...( ctx . app . router ? { routingInstrumentation : vueRouterInstrumentation ( ctx . app . router ) } : { } ) ,
5757 ...browserTracing ,
5858 } ) )
5959 merge ( config , vueOptions , tracingOptions )
@@ -79,9 +79,8 @@ export default async function (ctx, inject) {
7979 }
8080
8181 /* eslint-enable object-curly-spacing, quote-props, quotes, key-spacing, comma-spacing */
82- Sentry . init ( config )
83- < % } % >
84-
85- inject ( 'sentry' , Sentry )
86- ctx . $sentry = Sentry
82+ init ( config )
83+ const sentryClient = getCurrentHub ( ) . getClient ( )
84+ inject ( 'sentry' , sentryClient )
85+ ctx . $sentry = sentryClient
8786}
0 commit comments