Fork ReactDOMSharedInternals for www (#25791)
This isn't the right way to do this, but internally we have some restrictions so we need to add an indirection. Let's land this now so we can catch up our sync and then fix forward from there. Co-authored-by: Jan Kassens <jkassens@meta.com>
lauren committed
Dec 5, 2022 at 12:08 UTC
2ccfa657d9529cab25eaa25144efc64df12b13c7
2 files changed
+24
packages/shared/forks/ReactDOMSharedInternals.www.js
new
+16
@@ -0,0 +1,16 @@
1
+/**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow
8
+ */
9
+
10
+// $FlowIgnore[cannot-resolve-module] provided by www
11
+const ReactDOM = require('ReactDOMComet');
12
+
13
+const ReactDOMSharedInternals =
14
+ ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
15
+
16
+export default ReactDOMSharedInternals;
scripts/rollup/forks.js
+8
@@ -70,6 +70,14 @@ const forks = Object.freeze({
70
if (entry === 'react-dom' || entry === 'react-dom/server-rendering-stub') {
71
return './packages/react-dom/src/ReactDOMSharedInternals.js';
72
}
73
+ switch (bundleType) {
74
+ case FB_WWW_DEV:
75
+ case FB_WWW_PROD:
76
+ case FB_WWW_PROFILING:
77
+ return './packages/shared/forks/ReactDOMSharedInternals.www.js';
78
+ default:
79
+ break;
80
+ }
81
if (
82
!entry.startsWith('react-dom/') &&
83
dependencies.indexOf('react-dom') === -1