我不确定为什么会出现这个错误,因为如果将错误传递给bugsnag控制台,显然会定义bugsnag:
这是我的file文件:
import { Client } from 'bugsnag-react-native';
import Config from 'react-native-config'
export const bugsnag = new Client(Config.BUGSNAG_KEY);
config具有正确的API密钥
下面是我的错误文件:
import bugsnag from './bugsnag'
export default function (err) {
console.log("BUGSNAG ERR", err);
if (err) {
if (!err.stack) {
err = new Error(err)
}
bugsnag.notify.apply(bugsnag, [err])
}
}
这是我的index.js
// eslint-disable-next-line no-unused-vars
import bugsnag from './app/configs/bugsnag';
我试着遵循bugsnags文档中的所有react原生设置,但显然我遗漏了一些东西。感谢所有的帮助。
发布于 2019-05-30 03:52:13
问题是我是如何导入文件的:
因为我使用了:
export const bugsnag
我需要使用:
import { bugsnag } from './bugsnag'
基于这篇文章:
https://medium.com/@etherealm/named-export-vs-default-export-in-es6-affb483a0910
https://stackoverflow.com/questions/56368286
复制相似问题