From 3e15b1c69014ad6767eac645228a052df861edc0 Mon Sep 17 00:00:00 2001 From: Sunil Pai Date: Mon, 14 Jan 2019 16:35:56 +0000 Subject: [PATCH] make a fork for ReactCurrentDispatcher (#14588) --- .../react/src/forks/ReactCurrentDispatcher.www.js | 8 ++++++++ scripts/rollup/forks.js | 13 +++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 packages/react/src/forks/ReactCurrentDispatcher.www.js diff --git a/packages/react/src/forks/ReactCurrentDispatcher.www.js b/packages/react/src/forks/ReactCurrentDispatcher.www.js new file mode 100644 index 0000000000000..d5a784ad6476d --- /dev/null +++ b/packages/react/src/forks/ReactCurrentDispatcher.www.js @@ -0,0 +1,8 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +export default require('ReactCurrentDispatcher'); diff --git a/scripts/rollup/forks.js b/scripts/rollup/forks.js index 934d21328922a..b5044a1f641dc 100644 --- a/scripts/rollup/forks.js +++ b/scripts/rollup/forks.js @@ -218,6 +218,19 @@ const forks = Object.freeze({ } }, + // Similarly, we preserve an inline require to ReactCurrentDispatcher. + // See the explanation in FB version of ReactCurrentDispatcher in www: + 'react/src/ReactCurrentDispatcher': (bundleType, entry) => { + switch (bundleType) { + case FB_WWW_DEV: + case FB_WWW_PROD: + case FB_WWW_PROFILING: + return 'react/src/forks/ReactCurrentDispatcher.www.js'; + default: + return null; + } + }, + // Different wrapping/reporting for caught errors. 'shared/invokeGuardedCallbackImpl': (bundleType, entry) => { switch (bundleType) {