react-native-web module with native extension not found even though I'm targeting it in webpack

Viewed 282

I have a RN project to which I'm adding react native web. I "ejected" from react-scripts and tweaked the webpack babel-loader config to target node_modules and ios.js extension files

// webpack.config.js
test: /\.(js|mjs|jsx|ts|tsx|ios.js)$/,
include: [paths.appSrc, paths.appNodeModules],
loader: require.resolve('babel-loader'),

I'm importing @invertase/react-native-apple-authentication and getting the following error in the terminal:

Module not found: Can't resolve './AppleButton' in '/home/goldy/apps/bites-native/node_modules/@invertase/react-native-apple-authentication/lib'

In the code of this package, there's no AppleButton.js, but there is AppleButton.ios.js, which I'm targeting in my config.

So what am I doing wrong here?

1 Answers

I solved it with adding .ios.js to the extensions list in webpack.config.js, under resolve.extensions

Related