Hacker News new | ask | show | jobs
by TDiblik 1053 days ago
Tbh, I liked expo, but since you cannot build locally nowdays (you can eject and build, but that won't work 99% of the time, literally didn't work for me on the hello world example), I kinda just threw it in the "cool, but won't use" bucket for time beeing :/, could change in the future, but I don't know how I feel about 3d party service (EAS) building my app and holding my signing certificates (yet)
5 comments

I got a bit this feeling when I tried to run the app locally offline during a flight and couldn't, because the client could not call home.

Turns out the client needs an --offline flag to so so, and I got a bit creeped out to have such a dependency.

The Expo Go app needs to connect to a server for two reasons: the server gives you a signing certificate that is used to sign your project manifest, and it also fetches the list of active and recent projects and Snacks. It is certainly not intended to be invasive.

Expo Go is entirely optional and it is recommended to graduate early on in your development cycle to using a development build of your own app instead. Development builds don't sign project manifests (unless you're intentionally using end-to-end signed updates, an advanced feature). They are like regular development builds of a traditional native app.

Also if you'd like to keep using Expo Go, the signing certificate mentioned earlier has an expiry of 30 days or so IIRC, during which time you don't need to connect to a server. You may still want to provide the "--offline" flag to turn off refreshing the certificate.

FYI I've made a patchset that pretty much allows me to actually use the EAS --local builds offline and without an EAS account, so it's in fact possible, even though they, for obvious reasons (e.g. https://github.com/expo/eas-cli/issues/1606), don't encourage it.
Would you mind sharing this? I’ve only used expo for experimental non-production apps so far but it works be great to be able to do this if ever needed. Reading this thread makes me a bit more hesitant about using expo.
Sure! I've uploaded the relevant patches here https://gist.github.com/irisjae/08f55a52f7e4bcb81613061fc217...

My full build process is somewhat more complicated to keep my $HOME clean and remove other impurities, but just these patches should be enough to enable offline building.

EAS CLI is designed for EAS, the hosted services. It is intended to use your EAS account, which I suspect is why the PR wasn't accepted.

Expo CLI is for entirely local builds. Run "npx expo prebuild:{android,ios}" to generate your Android Studio and Xcode projects, and build them with the IDEs or their respective CLI tools directly.

You can build locally without ejecting; just throw the --local flag on the end of your eas build command This does what EAS would do, just on your local machine. If you remove the --local flag, it will send it up to EAS to do the build.

eas build --profile develop --platform ios --local

yes, you are right, however, AFAIK you still need to be logged + have it linked to eas project (because it uses eas credentials) + this method is planned to be deprecated soon [?] (I'm 100% sure I read stuff like this when researching it like half a year ago, but cannot find it for the love-of-god atm :D, but I would like to be proved otherwise, because the build step is the only thing I disliked about expo long-term wise)

... now looking more into it, I probably mistook `npm run export` / `expo build` with `eas build --local`. Is this correct?

I think your commands are kind of muddled. By `npm run export`, I assume you are referring to `expo export`? That is responsible for bundling your app for OTA updates. `expo build` is the deprecated method for building your Expo app with the old ExpoKit native shell app. Only `eas build --local` is the actual command for locally building your app.

Perhaps the issue you're thinking about was what I linked to in my other comment?

By my own thinking, I believe it's quite unlikely that Expo will ever manage to actually totally remove support for local builds, even though they probably will never encourage it; as otherwise, its really quite impossible to debug native builds, and indeed local builds are Expo's recommendation for debugging such issues. With regular React Native native dependencies now possible in Expo, a dizzying new array of hard to diagnose bugs can now be triggered, and its unlikely Expo is ever going to go back on their support for arbitrary native dependencies.

Yeah, afaik, in the old template version `npm run export` activated the `expo export` and THAT got deprecated (recently), however at the time (about half a year ago) I thought that the `--local` flag was getting deprecated. Sorry, that was a huge misunderstanding on my end!
Building Expo apps on your own hardware is definitely supported. Specifically, run "npx expo prebuild:{android,ios}" to generate your project's "android" and "ios" directories. Open them up in Android Studio and Xcode (or use their command-line equivalents), respectively, and build.

The managed services (EAS) are optional for Expo apps. The independence between Expo, the free and open source framework, and EAS, the hosted service offering, is something the Expo team consciously works on.

Based on our experience with, well, everything, even if local build is currently possible, we KNOW it's going to be removed later on.
Building Expo apps locally is not going to be removed. I am one of the cofounders of Expo.

Being able to build your app on your own hardware is a relatively fundamental feature of any application software framework. The Expo framework is free and open source and we consciously keep it decoupled from Expo Application Services (EAS), which is a suite of hosted services we manage.

Two of the ways to build your app are: - Entirely locally, without EAS: generate your native Android and iOS projects with "npx expo prebuild:{android,ios}" and build your app with Android Studio/Gradle and Xcode/xcodebuild, respectively. - With EAS: after getting set up with EAS, installing EAS CLI, and configuring eas.json, run "eas build". There is also a "--local" flag that runs the compilation steps locally and uses your signing credentials managed by EAS.

Many developers use a mix. For instance, they'll build locally when working on a feature for a fast feedback loop. And they'll use EAS to build their release candidates and PR previews to share with their team.

Would be nice if an expo dev could assure us that this won't happen and also remove the dependencies for them while building