Skip to content

Commit

Permalink
Don't validate ENTRY_FILE in react-native-xcode.sh (#32762)
Browse files Browse the repository at this point in the history
Summary:
Reverts #29012

It is not really possible to properly validate if ENTRY_FILE exists since it is resolved by metro, and the server is not always running from the app root, like in a monorepo with multiple RN apps running on the same metro server.

In my case I run metro on the repo root and entry file will be something like `apps/app/index.js`. `-f "$ENTRY_FILE"` will fail since the script is run from the project folder (`PROJECT_ROOT`, in my case the `apps/app` folder, so it tries to resolve `apps/app/apps/app/index.js`).

I don't think this check is actually useful since metro will report the error if the entry file is invalid (fixed in #30150). The error is not as user friendly, but I think it is still fine. Maybe it could be improved in metro.

## Changelog

[iOS] [Fixed] - Don't validate ENTRY_FILE in react-native-xcode.sh

Pull Request resolved: #32762

Test Plan:
Before

<img width="854" alt="image" src="https://user-images.githubusercontent.com/2677334/146100834-39310c9f-1767-496a-8698-1026726a1120.png">

After if file is actually missing

<img width="987" alt="image" src="https://user-images.githubusercontent.com/2677334/146100893-d01e2247-c787-4174-ac60-2f308c338c8f.png">

After if file exists, builds successfully.

Reviewed By: cortinico

Differential Revision: D37066073

Pulled By: cipolleschi

fbshipit-source-id: 8f6b149099a39d9179996bb965daa6cd9e06feac
  • Loading branch information
janicduplessis authored and facebook-github-bot committed Jun 10, 2022
1 parent 9eb2826 commit 780fe80
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions scripts/react-native-xcode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ else
ENTRY_FILE=${1:-index.js}
fi

if [[ $DEV != true && ! -f "$ENTRY_FILE" ]]; then
echo "error: Entry file $ENTRY_FILE does not exist. If you use another file as your entry point, pass ENTRY_FILE=myindex.js" >&2
exit 2
fi

# check and assign NODE_BINARY env
# shellcheck source=/dev/null
source "$REACT_NATIVE_DIR/scripts/node-binary.sh"
Expand Down Expand Up @@ -184,4 +179,4 @@ if [[ $DEV != true && ! -f "$BUNDLE_FILE" ]]; then
echo "error: File $BUNDLE_FILE does not exist. This must be a bug with" >&2
echo "React Native, please report it here: https://github.com/facebook/react-native/issues"
exit 2
fi
fi

0 comments on commit 780fe80

Please sign in to comment.