I am using react native web with react-navigation. I am getting this error:
Module not found: Can't resolve './PlatformHelpers' in '/home/vineet/projects/jm-agent-web/node_modules/react-navigation/lib'
I am getting this error because these files are present: PlatfomrHelpers.ios.js, PlatfomrHelpers.android.js, PlatfomrHelpers.web.js. But there is no PlatfomrHelpers.js.
So my ES6 importing system is not able to import PlatfomrHelpers.web.js for the import name ' PlatfomrHelpers' in react-native-web.
How to solve this?
I would like to share the solution that I implemented and its a really easy one.
The problem can be solved by telling webpack to prioritize import of .web.js file.
I went into my webpack.config.js file. Inside top level 'resolve' property I can add '.web.js' as an element in the 'extensions' array. The following code solved it:
Now my webpack is picking up 'PlatfomrHelpers.web.js' for the statement: