The website uses SignalR. When the user clicks on the browser that comes with the Vivo mobile phone, there is no response. After connecting to the computer with a data cable, I found an error: AbortController is Undefined after debugging in Chrome. Google looked around and found this article SignalR AbortController is Undefined on Older Browsers , which basically explained the reason and gave a solution.

It is because the old browser supports Fetch, but AbortController does not support it, which leads to this error. Just change the judgment, as long as you don't support one of them, don't use FetchHttpClient.

Put at node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js

if (typeof fetch !== "undefined" || Platform.isNode) {

changed to:

if ((typeof fetch !== "undefined" && typeof AbortController !== "undefined") || Platform.isNode) {

Because it is a direct modification of node_modules, the official library has not been repaired, so you need to patch it yourself.

  1. Install patch-package: yarn add patch-package --dev
  2. Save the module: npx patch-package @microsoft/signalr
  3. Add a running command to the scripts of package.json:
"scripts": {
    "postinstall": "patch-package",
    "patch-package":"patch-package"
},

rayliao
3.1k 声望48 粉丝

前端渣滓