Platform specific packages

Let’s say I want to install a package in my project but only for web - it is not used by iOS/Android and I do not want it bundled/linked for those platforms.

I know;

  1. I can use the <name>.native.<extension> naming convention to specify files as iOS/Android and thereby assign <name>.<ext> to web only or use the <name>.web.<ext> to achieve the same effect but that is not what I’m after.
  2. I can use the Platform module to branch code to use specific modules at runtime but again that is not what I’m after.

It is possible to do what I want in react-native. From here; using react-native.config.js we can do the following;

For example, you could set:

module.exports = {
  dependencies: {
   ‘react-native-webview’: {
      platforms: {
           ios: null,

in order to disable linking of React Native WebView on iOS.

Can I do this in expo and if so how ?

Hi @bobae

Disabling linking of the native code like that vaguely rings a bell. I think I might have seen a message on the forums from one of the Expo team members saying how it can be done. But I had a bit of a search and couldn’t find it.

Since EAS is supposed to be able to build any React Native app, what happens if you try creating a react-native.config.js file like that and building with EAS Build?

Another thought: Maybe you could split your app in two (mobile vs. web) and put them both in the same monorepo with most of the code shared? I have not worked with monorepos myself, but it seems like that should be possible.