I took over a react native project for another developer.
It runs fine if I start it using yarn ios. That command starts metro, loads the app on the ios simulator and then does the js build and loads fine.
It also creates the ios xcode workspace project.
If I then run the yarn build:ios command (which points to this in the package.json file):
react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios' --assets-dest='ios'
The it builds the main.jsbundle into the xcode project folder.
When I open that workspace and build, everything builds just fine.
When I run that I get the following html output in the app, in the metro output and the xcode debug output:
<html lang="en">
Error
Error: Unable to resolve module ./index from /Users/[redacted]/.:
None of these files exist:
* index(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
* index/index(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
at ModuleResolver.resolveDependency (/Users/[redacted]/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:136:15)
at DependencyGraph.resolveDependency (/Users/[redacted]/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/node-haste/DependencyGraph.js:231:43)
at /Users/[redacted]/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/lib/transformHelpers.js:129:24
at Server._resolveRelativePath (/Users/[redacted]/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/Server.js:1107:12)
at async Server.requestProcessor [as _processBundleRequest] (/Users/[redacted]/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/Server.js:450:37)
at async Server._processRequest (/Users/[redacted]/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/Server.js:406:9)