From e73208e2ca59a2cf6a8a9c5e4e5b33afb5131f09 Mon Sep 17 00:00:00 2001 From: Petr Bela Date: Thu, 18 Jun 2020 13:24:23 -0700 Subject: [PATCH] Better error message when missing entry file (#29012) Summary: If the entry file has been renamed (e.g., to `index.ts`), the script currently fails silently and prints out that the bundle file does not exist. This change will print the correct error message instead. ## Changelog [iOS] [Fixed] - Better error message when missing entry file Pull Request resolved: https://github.com/facebook/react-native/pull/29012 Test Plan: N/A Reviewed By: hramos Differential Revision: D22109657 Pulled By: TheSavior fbshipit-source-id: edd7b6f88becc954ee41ed01ae43efb4481adc95 --- scripts/react-native-xcode.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/react-native-xcode.sh b/scripts/react-native-xcode.sh index f0cfa0fd54f..db8586c788e 100755 --- a/scripts/react-native-xcode.sh +++ b/scripts/react-native-xcode.sh @@ -78,9 +78,14 @@ if [[ "$ENTRY_FILE" ]]; then # Use ENTRY_FILE defined by user : elif [[ -s "index.ios.js" ]]; then - ENTRY_FILE=${1:-index.ios.js} - else - ENTRY_FILE=${1:-index.js} + ENTRY_FILE=${1:-index.ios.js} +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 if [[ -s "$HOME/.nvm/nvm.sh" ]]; then