Skip to content

Instantly share code, notes, and snippets.

@Grohden
Last active January 14, 2025 20:15
Show Gist options
  • Save Grohden/5934a6a6ff109d8f44dfa67c3745c3e2 to your computer and use it in GitHub Desktop.
Save Grohden/5934a6a6ff109d8f44dfa67c3745c3e2 to your computer and use it in GitHub Desktop.
Description of an issue that I had with expo cli

First of all: I'm writting this one to help people (I'm hoping google indexes it)

Recently, with AppCenter being deprecated we've started migrating to expo EAS, we also wanted to "use expo", and that means we'll need to setup expo modules, which I did following the tutorial

However, after successfuly compiling to iOS, I had issues in android, one very annoying one was EarlyJSError: unexpected token "." stack, it made me lose 3 days of my sanity due to various factors

Anyway, the problem is that, by following expo tutorial, I've ran their cli and it changed our getJSMainModuleName to:

override fun getJSMainModuleName(): String = ".expo/virtual-entry"

Which doesn't work in android when you combine newArchEnabled=true + hermesEnabled=false (iirc it worked with hermes true). I can only guess that the . token is the .expo/... part, but there's absolutely no possible detail about that trace and when I tried changing the . for another char the error changed to a "cannot find entry", so I dismissed that.

After recreating a project from scratch, adding expo and ruling out dependencies and code, I've found out that actually, you should be sticking with the normal entry:

override fun getJSMainModuleName(): String = "index"

Note: another thing that made me lose too much time was that, when I thought "its something bout main module name", I tested it with "index.js", which didn't work and made me dismiss this possibility

I hope this explanation or ref about the EarlyJSError: unexpected token "." stack issue helps someone.

@Grohden
Copy link
Author

Grohden commented Jan 14, 2025

I had another one, EarlyJSError: unexpected token "?" stack, which was caused by me inputing the wrong jsEngine entry in app.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment