Bugfender: ReferenceError: Can’t find variable: BroadcastChannel

huangapple go评论75阅读模式
英文:

Bugfender: ReferenceError: Can't find variable: BroadcastChannel

问题

我在我的Vue.js应用程序中使用Bugfender,在Chrome中运行正常,但在我的Safari Mac中不起作用。

Safari版本15.3(17612.4.9.1.5)
@bugfender/sdk: 2.2.2

浏览器控制台中的错误:ReferenceError: 找不到变量:BroadcastChannel

我已经回溯了这个问题,它来自bugfender/sdk/lib/index.js

有没有人遇到类似的问题?

英文:

I am using bugfender in my vue js application, which works fine in Chrome but doesn't work in my Safari Mac.

Safari Version 15.3 (17612.4.9.1.5)
@bugfender/sdk: 2.2.2

Error in browser console: ReferenceError: Can't find variable: BroadcastChannel

I did backtrack this issue and it's from bugfender/sdk/lib/index.js

Has anyone face the similar issue?

答案1

得分: 3

BroadcastChannel 只支持 Safari 15.4 及以上版本。参考链接:https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel

如果你想在 Safari 15.3 及更早的版本中使用,请使用以下代码:

import { BroadcastChannel } from 'broadcast-channel';

Object.assign(window, { BroadcastChannel })

你必须在所有其他脚本之前运行这个脚本

英文:

BroadcastChannel only supports safari from 15.4 and up. Reference: https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel

if you want use in safari 15.3 down. Use:

import { BroadcastChannel } from 'broadcast-channel'

Object.assign(window, { BroadcastChannel })

> you must run this script before all

答案2

得分: 1

升级 @bugfender/sdk 到 2.2.3,这将在较旧的 Safari 版本中正常工作。

英文:

Upgrade @bugfender/sdk to 2.2.3 and this will work in older safari version.

答案3

得分: 0

不要将 broadcast-channel 添加到 window,请查看屏幕
Bugfender: ReferenceError: Can’t find variable: BroadcastChannel

只需添加这个 polyfill
https://github.com/JSmith01/broadcastchannel-polyfill/blob/master/index.js

懒加载
像这样
Bugfender: ReferenceError: Can’t find variable: BroadcastChannel

英文:

@Tachibana Shin,

don't add broadcast-channel to window, look at the screen
Bugfender: ReferenceError: Can’t find variable: BroadcastChannel

just add the polyfill
https://github.com/JSmith01/broadcastchannel-polyfill/blob/master/index.js

lazy-load
like this
Bugfender: ReferenceError: Can’t find variable: BroadcastChannel

huangapple
  • 本文由 发表于 2023年2月10日 13:23:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/75407263.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定