Platform.OS is 'web' on Device/Simulator

Hi everybody,

when I create a Build Archive/Simulater, or just open the “expo publish” App in the ExpoGo App,
I get “ReferenceError: Can’t find variable: document” : Sentry

I modified the expo/build/launch/registerRootComponent.js to:

import 'expo/build/Expo.fx';
import { AppRegistry, Platform } from 'react-native';
import withExpoRoot from './withExpoRoot';
export default function registerRootComponent(component) {
    AppRegistry.registerComponent('main', () => withExpoRoot(component));
    console.error('Platform.OS', Platform.OS, Platform.Version)
    if (Platform.OS === 'web') {
        const rootTag = document.getElementById('root') ?? document.getElementById('main');
        AppRegistry.runApplication('main', { rootTag });
    }
}

Result on Device/ExpoGo from “default”-Channel, TestFlight or Simulator-Build, I get Platform “web” on the device:

If I start the App via “expo start”, I get the correct Platform “ios”:

Anybody an idea on how to fix that? :slight_smile:

Greetings,
Chris

could you share a reproducible example please? it’s likely that you have broken your babel or metro config somehow