TypeError: Object.fromEntries is not a function

TypeError: Object.fromEntries is not a function

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

我找不到解决方案。

我正在使用的库

 "@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"

我尝试过的东西

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

解决方案是为 Object.fromEntries 安装 polyfill 并将其导入 _app.tsx 文件。

  1. polyfill-object.fromentries