reactjstypescriptandroid-emulatorsnowpack

Why might an "Unhandled Runtime Error" from a React app be encountered only on android emulator?


I am trying to open a web-based React-app on chrome on an Android emulator but am getting the following error: Unhandled Runtime Error Uncaught SyntaxError: Unexpected Token .

The same app can be opened through chrome on localhost or through mobile chrome on my smartphone but not on the android emulator. Any thoughts why this is happening and how it could be solved?

enter image description here

Local setup:


Solution

  • If anyone happens to have the same problem, the solution is to add the following packages to both package.json and babel config plugins:

    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5" / 
    "@babel/plugin-proposal-optional-chaining": "^7.14.5"