Babel preset @expo/vector-icons module resolution

Hi!

I moved my app from ExpoKit workflow to Bare and now I want to replace @expo/vector-icons with react-native-vector icons.

I removed @expo/vector-icons dependency and installed react-native-vector-icons properly.

The problem is that I still have babel-preset-expo from times of my ExpoKit app. It is working fine in bare but it has little nasty thing that leads to this problem: https://github.com/oblador/react-native-vector-icons/issues/1261.

It caused by this preset configuration in babel-preset-expo/index.js:

 if (hasModule('@expo/vector-icons')) {
    aliases['react-native-vector-icons'] = '@expo/vector-icons';
  }

The problem with this that I am still has expo dependency in project even after eject and it is doing only AppRegistry stuff. expo dependency has “@expo/vector-icons” sub-dependency that leads to preset working with resolving my react-native-vector-icons with @expo/vector-icons from expo.

So i have this questions:

  1. Do I still need expo dependency. What does expo dependency gives to me? I am using expo-updates with self-hosted bundles bundled with expo export.
    Also I am using a lot of unimodules.
    Here is the list:
{
"expo-analytics-segment": "~9.0.0",
    "expo-apple-authentication": "~2.2.1",
    "expo-asset": "~8.2.0",
    "expo-av": "~8.6.0",
    "expo-barcode-scanner": "~9.0.0",
    "expo-constants": "~9.2.0",
    "expo-device": "~2.3.0",
    "expo-document-picker": "~8.4.0",
    "expo-file-system": "~9.2.0",
    "expo-font": "~8.3.0",
    "expo-image-picker": "~9.1.1",
    "expo-keep-awake": "~8.3.0",
    "expo-linear-gradient": "~8.3.0",
    "expo-localization": "~9.0.0",
    "expo-location": "~9.0.0",
    "expo-media-library": "~9.2.1",
    "expo-permissions": "~9.3.0",
    "expo-screen-orientation": "^2.0.0",
    "expo-splash-screen": "~0.6.2",
    "expo-status-bar": "~1.0.2",
    "expo-updates": "^0.3.5",
    "expo-video-player": "github:forked/expo-video-player",
    "expo-video-thumbnails": "~4.3.0",
}
  1. If the expo dependency still needed: I think that i am supposed to remove babel-preset-expo. I think that i can figure out how to replace it but It will be super cool if someone already done this and can share their preset.
1 Like

Hi,

were you able to find the solution? I’m facing the exact same issue. It took me a few hours to find out why my vector icons are not working as expected.

Hi!
I figured out that it it possible to rewrite .babelrc file from expo-preset to custom to make things work.
Only problem with vector icons that i had is forced rewrite of react-native-vector-icons module in babel-preset-expo.

Check my comment here: