diff --git a/packages/react/src/React.js b/packages/react/src/React.js index 3cb0d13a13a05..3c3cafe88bcf6 100644 --- a/packages/react/src/React.js +++ b/packages/react/src/React.js @@ -71,9 +71,6 @@ import ReactSharedInternals from './ReactSharedInternals'; import {startTransition} from './ReactStartTransition'; import {act} from './ReactAct'; -// Patch fetch -import './ReactFetch'; - // TODO: Move this branching into the other module instead and just re-export. const createElement: any = __DEV__ ? createElementWithValidation diff --git a/packages/react/src/ReactSharedSubset.experimental.js b/packages/react/src/ReactSharedSubset.experimental.js index 1283c51a9ad53..94dd4c2efbc88 100644 --- a/packages/react/src/ReactSharedSubset.experimental.js +++ b/packages/react/src/ReactSharedSubset.experimental.js @@ -7,6 +7,9 @@ * @flow */ +// Patch fetch +import './ReactFetch'; + export { __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, Children, diff --git a/packages/react/src/__tests__/ReactFetch-test.js b/packages/react/src/__tests__/ReactFetch-test.js index c68c697e29d6e..6d25a9ddd05a6 100644 --- a/packages/react/src/__tests__/ReactFetch-test.js +++ b/packages/react/src/__tests__/ReactFetch-test.js @@ -41,6 +41,9 @@ describe('ReactFetch', () => { fetchCount = 0; global.fetch = fetchMock; + if (gate(flags => flags.experimental && !flags.www)) { + jest.mock('react', () => require('react/react.shared-subset')); + } React = require('react'); ReactServerDOMServer = require('react-server-dom-webpack/server.browser'); ReactServerDOMClient = require('react-server-dom-webpack/client');