mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Opt out react-forget-runtime from being Forgotten
This caused a build error when Forget was used in an Expo app as the react-forget-runtime package was itself being compiled with Forget. This broke Metro as metro serializes modules to iifes, but the import syntax that was injected by the useMemoCachePolyfill flag was left behind In practice I don't think the runtime package needs to ever be compiled by Forget, so this PR opts out the whole file. This would also prevent builds from breaking if someone decided to use the "all" compilation mode. Test plan: Ran the expo app and verified that it now builds with no errors
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
"use no forget";
|
||||
|
||||
import invariant from "invariant";
|
||||
import * as React from "react";
|
||||
|
||||
@@ -24,7 +26,6 @@ const $empty = Symbol.for("react.memo_cache_sentinel");
|
||||
* DANGER: this hook is NEVER meant to be called directly!
|
||||
**/
|
||||
export function unstable_useMemoCache(size: number) {
|
||||
"use no forget";
|
||||
return React.useState(() => {
|
||||
const $ = new Array(size);
|
||||
for (let ii = 0; ii < size; ii++) {
|
||||
|
||||
Reference in New Issue
Block a user