Big Int error in React production build?

Uncaught TypeError: Cannot convert a BigInt value to a number

While developing your React app with @web3auth/modal, there might be a case where the application is working fine in development mode, but when you build the app for production, you get the following error:

Uncaught TypeError: Cannot convert a BigInt value to a number

This error is caused by the fact that the production build of React is not specified the versions of the browsers. Due to this, the production build of React uses the default browserlist configuration, which might lead to the above error.
This can be solved by changing the production value to the following lines of your package.json file:

"browserslist": {
    "production": [
      "chrome >= 67",
      "edge >= 79",
      "firefox >= 68",
      "opera >= 54",
      "safari >= 14"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }

By adding these lines, you are telling the Javascript bundlers to use specific versions of the browsers for the production build. After adding the above lines, create the production build again, and you should be good to go.

Read more