From 9bc12b354c8d28868cba5cce6dd772a5747e99bd Mon Sep 17 00:00:00 2001 From: Abreto Fu Date: Thu, 29 Nov 2018 17:13:49 +0800 Subject: [PATCH 1/3] add await --- local-cli/src/bundle.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/local-cli/src/bundle.js b/local-cli/src/bundle.js index 7e38058..bf3bcb7 100644 --- a/local-cli/src/bundle.js +++ b/local-cli/src/bundle.js @@ -405,7 +405,7 @@ export const commands = { if (major === 0) { if (minor >= 57) { // https://github.com/facebook/react-native/commit/a32620dc3b7a0ebd53feeaf7794051705d80f49e#diff-75692fe55c8b1a7c05f4264301342167L101 - defaultConfig = Config.load(); + defaultConfig = await Config.load(); } else if (minor >= 45) { defaultConfig = Config.findOptional(path.resolve('.')); } else if (minor >= 42) { From 0d599fd988558c5c1aaae3f5deb038d6febe3bbd Mon Sep 17 00:00:00 2001 From: Abreto Fu Date: Thu, 29 Nov 2018 23:54:21 +0800 Subject: [PATCH 2/3] it actually accept a Promise --- local-cli/src/bundle.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/local-cli/src/bundle.js b/local-cli/src/bundle.js index bf3bcb7..7e38058 100644 --- a/local-cli/src/bundle.js +++ b/local-cli/src/bundle.js @@ -405,7 +405,7 @@ export const commands = { if (major === 0) { if (minor >= 57) { // https://github.com/facebook/react-native/commit/a32620dc3b7a0ebd53feeaf7794051705d80f49e#diff-75692fe55c8b1a7c05f4264301342167L101 - defaultConfig = await Config.load(); + defaultConfig = Config.load(); } else if (minor >= 45) { defaultConfig = Config.findOptional(path.resolve('.')); } else if (minor >= 42) { From 688a2c7086927244d5d0087af529b58a15f6508e Mon Sep 17 00:00:00 2001 From: Abreto Fu Date: Fri, 30 Nov 2018 15:55:26 +0800 Subject: [PATCH 3/3] fix loading config with rn >= 0.57 --- local-cli/src/bundle.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/local-cli/src/bundle.js b/local-cli/src/bundle.js index 7e38058..6b77cee 100644 --- a/local-cli/src/bundle.js +++ b/local-cli/src/bundle.js @@ -405,7 +405,9 @@ export const commands = { if (major === 0) { if (minor >= 57) { // https://github.com/facebook/react-native/commit/a32620dc3b7a0ebd53feeaf7794051705d80f49e#diff-75692fe55c8b1a7c05f4264301342167L101 - defaultConfig = Config.load(); + // defaultConfig = Config.load(); + const { configPromise } = require(path.resolve('node_modules/react-native/local-cli/core')); + defaultConfig = await configPromise; } else if (minor >= 45) { defaultConfig = Config.findOptional(path.resolve('.')); } else if (minor >= 42) {