Open prabirshrestha opened 6 days ago
We actually compile that away during build and use platform-specific file extensions in the output instead, so it shouldn't actually depend on that.
Is there some bug you're seeing? You can generally use isWeb
or Platform.OS from react-native to detect platforms.
If isWeb works that it should be ok as long as it has dead code elimination so unnecessary js doesn't get loaded. I did find using TAMAGUI_TARGET a bit weird hence the issue.
For dead code elimination we set environment variables, but we need more testing around it. I documented it here:
I'm trying to use react-native-paper without tamagui but seems color-scheme package depends on TAMAGUI_TARGET for detecting native vs web.
I see there are other packages depending on it too. https://github.com/search?q=repo%3Aonejs%2Fone%20TAMAGUI_TARGET&type=code.
Should it instead have
ONE_TARGET
?In the meantime how can one explicitly set
TAMAGUI_TARGET
in vite.config.ts so it works with web and iOS/android.