Uncaught Error: Can't find variable: Component

Heyo,

I’m having some issues with getting my app working. It works perfectly fine in development (even through Expo app), but after an exp publish it fails when it’s on production.

The error is:

Uncaught Error: Can't find variable: Component
<unknown>@cached-bundle-experience-%40markspolakovs%2feuroschool-app1787421859-22.0.0:679

The app is in TypeScript with react-native-typescript-transformer. I’m running on Android 8.0.0 on a Nexus 5X, Expo version 22.0.0.

If it helps troubleshooting, the app is published at https://exp.host/@markspolakovs/euroschool-app and the source code is at https://github.com/eslcc/euroschool-app.

One thing you could do to debug is to turn off dev mode. You can do this in exp via the command line (see exp start --help to turn “dev” off) or under the gear icon by the URL bar in XDE.

Another thing is to turn on minification (via similar ways as dev mode, there’s just another option for minification) in case that’s causing issues.

I think the Component namespace has been dropped.

You could try using these type definitions for the Expo SDK: https://github.com/janaagaard75/expo-and-typescript. It’s still very much a work in progress, and that the majority of the APIs haven’t yet been tested, but it might help weed out some of the bugs.