UNPKG

1.01 kBJavaScriptView Raw
1import VueLib from 'vue'
2import * as Sentry from '@sentry/browser'
3import { <%= Object.keys(options.integrations).map(integration => integration).join(', ') %> } from '@sentry/integrations'
4
5export default function (ctx, inject) {
6 const opts = Object.assign({}, <%= serialize(options.config) %>, {
7 integrations: [
8 <%= Object.keys(options.integrations).map(name => {
9 const integration = options.integrations[name]
10 if (name === 'Vue') {
11 return `new ${name}({Vue: VueLib, ...${serialize(integration)}})`
12 }
13 return `new ${name}({${Object.keys(integration).map(option => typeof integration[option] === 'function' ?
14 `${option}:${serializeFunction(integration[option])}` : `${option}:${serialize(integration[option])}`).join(',')}})`
15 }).join(',\n ') %>
16 ]
17 })
18
19 <% if (options.initialize) { %>// Initialize sentry
20 Sentry.init(opts)<% } %>
21
22 // Inject Sentry to the context as $sentry
23 inject('sentry', Sentry)
24 ctx.$sentry = Sentry
25}