mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-23 11:57:46 +08:00
Add no-packager option to run-android and run-ios commands
Summary: Currently, while running `react-native run-android` command, React Native's packager is launched, and there is not any way to disable the current behaviour. This is handled somehow on iOS by adding an environment variable `RCT_NO_LAUNCH_PACKAGER` (see #6180). This is a cross-platform solution that adds the `--no-packager` option both to `run-ios` and `run-android`, which prevents the packager from being launched. This was tested by building with and without the option, on both environments (Android and iOS) using the device and simulator, working as expected. Closes https://github.com/facebook/react-native/pull/11735 Differential Revision: D4392170 Pulled By: ericvicenti fbshipit-source-id: 1c31f109f18715b84cd5ab1b6d5fd758cd0a6efb
This commit is contained in:
committed by
Facebook Github Bot
parent
55427566b6
commit
52dea5db64
@@ -31,6 +31,10 @@ function runAndroid(argv, config, args) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!args.packager) {
|
||||
return buildAndRun(args);
|
||||
}
|
||||
|
||||
return isPackagerRunning().then(result => {
|
||||
if (result === 'running') {
|
||||
console.log(chalk.bold('JS server already running.'));
|
||||
@@ -286,5 +290,8 @@ module.exports = {
|
||||
command: '--deviceId [string]',
|
||||
description: 'builds your app and starts it on a specific device/simulator with the ' +
|
||||
'given device id (listed by running "adb devices" on the command line).',
|
||||
}, {
|
||||
command: '--no-packager',
|
||||
description: 'Do not launch packager while building',
|
||||
}],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user