Menu

Why my development build needs my computer: what Metro actually does
📰

Why my development build needs my computer: what Metro actually does

DEV Community: reactnative·Andy Yeung·14 days ago
#9VBHl9WA
#devtoreactnative#devto#dev#build#metro
Reading 0:00
15s threshold

Background

My app needed to test push notifications, which Expo Go can't do, so I made my first development build and installed it on my iPhone. I assumed I could take the phone out and test at my own pace.

As soon as I left my home Wi-Fi the app couldn't connect. The start command had always included a local port, and I had never thought about what it was for.

What I tried

Treating the development build as a finished app : I only learned it needed my computer once I was out.

Thinking Metro and Babel were the same thing : both "transform code", so I kept mixing them up.

Planning a new build for every small change : most changes don't need a build at all.

How I did it

1. Understand what Metro is

Metro is the bundler built into React Native and Expo. When you run npx expo start , Metro is what starts. It does four things:

Transform : turn TypeScript and JSX into plain JavaScript.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.