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;
- 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. - 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 ?