要将Sentry与Vue应用程序一起使用,您需要使用@ sentry / browser(Sentry的浏览器JavaScript SDK)。
@ sentry / browser本身会报告从您的应用程序触发的任何未捕获的异常。
此外,Vue集成将捕获引发错误的活动组件的名称和props状态。这是通过Vue的config.errorHandler钩子报告的。
传入Vue是可选的,如果你没有传递它.Vue必须存在。
import * as Sentry from '@sentry/browser'
Sentry.init({
dsn: 'https://<key>@sentry.io/<project>',
integrations: [new Sentry.Integrations.Vue({ Vue })]
})