react-native/scripts
Matthieu Lemoine 392b0845ce fix: Start Metro packager from project root (#24070)
Summary:
Fixes #23342.

Since Metro [v0.47](https://github.com/facebook/metro/releases/tag/v0.47.0), some babel plugins such as [babel-plugin-module-resolver](https://github.com/tleunen/babel-plugin-module-resolver) or [babel-plugin-import-graphql](https://github.com/detrohutt/babel-plugin-import-graphql) fail to resolve files if the packager is started through Xcode. They receive wrong filenames from Babel such as `${projectRoot}/node_modules/react-native/src/index.js` instead of `${projectRoot}/src/index.js`.

It happens because the start command of the local-cli is not executed in the projectRoot directory. In this case, the cwd will be `${projectRoot}/node_modules/react-native`.

This issue doesn't occur if you start the packager yourself using `node node_modules/react-native/local-cli/cli.js start` from your project root.

It comes from this [line](b640b6faf7/scripts/packager.sh (L11)). This script changed the working directory to `${projectRoot}/node_modules/react-native` and started Metro from there.

Starting Metro from the project root fixes this issue.

[iOS] [Fixed] - Start Metro packager from project root
Pull Request resolved: https://github.com/facebook/react-native/pull/24070

Differential Revision: D14563996

Pulled By: cpojer

fbshipit-source-id: cdeff34610f1ebb5fb7bc82a96f4ac9eec750d16
2019-03-22 18:23:28 +01:00
..
circleci Fix CircleCI build error (#22822) 2018-12-30 10:47:10 -08:00
versiontemplates Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
.packager.env Move YGStyle to seperate file and add constructors 2018-02-20 05:55:36 -08:00
.tests.env Bump to Android Build Tools 28.0.3, Gradle 4.10.2, Gradle Plugin 3.2.1 2019-01-11 12:24:59 -08:00
android-e2e-test.js Fix no shadow warnings (#22190) 2019-01-01 17:13:15 -08:00
android-setup.sh Individually accept licenses 2019-02-14 12:52:23 -08:00
bump-oss-version.js Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
ios-configure-glog.sh Upgrade folly to v2018.10.22.00 for iOS (#21976) 2018-10-29 12:13:11 -07:00
ios-install-third-party.sh Change location of iOS build cache directory to ~/Library/Caches/ (#22688) 2019-01-25 03:26:32 -08:00
launchPackager.bat Remove remaining references to local-cli 2018-12-10 19:08:10 -08:00
launchPackager.command Update RNTester snapshots 2018-12-18 16:20:10 -08:00
objc-test-ios.sh Propagate exit code in test_objc (#22562) 2018-12-10 20:34:12 -08:00
objc-test-tvos.sh Propagate exit code in test_objc (#22562) 2018-12-10 20:34:12 -08:00
objc-test.sh test_ios → : Update iOS Snapshots, remove tvOS tests, disable failing tests (#22720) 2018-12-20 15:08:47 -08:00
packager.sh fix: Start Metro packager from project root (#24070) 2019-03-22 18:23:28 +01:00
process-podspecs.sh Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
publish-npm.js Deploy to npm on tagged commits only (#21250) 2018-09-22 09:16:58 -07:00
react-native-xcode.sh Allow changing the project path in react-native-xcode.sh (#23273) 2019-02-04 08:01:24 -08:00
run-android-ci-instrumentation-tests.js Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
run-android-emulator.sh Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
run-android-local-integration-tests.sh Fix React Native calling CLI wo location 2019-02-13 17:10:41 +01:00
run-android-local-unit-tests.sh Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
run-ci-e2e-tests.js Move react-native template 2018-12-07 07:49:19 -08:00
run-instrumentation-tests-via-adb-shell.sh Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
sync-css-layout.sh Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
test-manual-e2e.sh RN: Missing Copyright Headers 2018-10-31 01:37:26 -07:00
try-n-times.js Fix linting issues (#22062) 2018-11-01 14:29:16 -07:00
validate-android-device-env.sh Use ShellCheck (#19681) 2018-09-28 17:03:24 -07:00
validate-android-sdk.sh Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
validate-android-test-env.sh fix validate-android-test-env.sh (#22961) 2019-01-14 10:54:18 -08:00
validate-ios-test-env.sh Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00