类型错误:Object.fromEntries 不是函数

mal*_*ala 2 typescript reactjs next.js chakra-ui

我在某些较旧的 iPhone(例如 iPhone 7 和 iPhone 10)上遇到此错误

类型错误:Object.fromEntries 不是函数

我无法找到解决方案。

我正在使用的库

 "@chakra-ui/react": "^1.4.1",
    "@chakra-ui/theme-tools": "^1.1.7",
    "@emotion/styled": "^11",
    "@stripe/react-stripe-js": "^1.2.0",
    "@stripe/stripe-js": "^1.11.0",
    "agora-rtc-sdk": "3.3.1",
    "agora-rtm-sdk": "1.4.1",
    "aws-sdk": "^2.828.0",
    "axios": "^0.21.1",
    "browser-image-compression": "^1.0.14",
    "crypto-js": "^4.0.0",
    "dayjs": "^1.10.3",
    "firebase": "^8.2.4",
    "framer-motion": "4.1.11",
    "js-cookie": "^2.2.1",
    "lodash": "^4.17.20",
    "nanoid": "^3.1.20",
    "next": "^11.0.1",
    "next-cookies": "^2.0.3",
    "next-pwa": "^5.0.6",
    "nextjs-redirect": "^5.0.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-feather": "^2.0.9",
    "react-hot-toast": "^1.0.2",
    "react-image-magnify": "^2.7.4",
    "react-player": "^2.7.2",
    "react-redux": "^7.2.2",
    "react-select": "^4.0.2",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0",
    "swiper": "^6.7.5",
    "use-http": "^1.0.18",
    "video.js": "^7.10.2",
    "yup": "^0.32.9"
Run Code Online (Sandbox Code Playgroud)

我尝试过的事情

  1. 将 NodeJS 从版本 12 升级到版本 14.17.1 (但这没有帮助)

mal*_*ala 5

解决方案是安装 polyfillObject.fromEntries并将其导入到 _app.tsx 文件中。

  1. polyfill-object.fromentries