Let ReactDOM initialize in RSC (#25503)

With the `react-dom/server-rendering-stub` you can import `react-dom` in
RSC so that you can call `preload` and `preinit` but if you don't alias
it, then requiring it breaks because we React.Component which doesn't
exist in the react subset.
This commit is contained in:
Sebastian Markbåge
2022-12-03 10:41:35 -05:00
committed by Rick Hanlon
parent 84ebdc2554
commit 4b0fb76bbd
5 changed files with 48 additions and 2 deletions
+8
View File
@@ -50,6 +50,14 @@ jest.mock('react', () => {
return jest.requireActual(resolvedEntryPoint);
});
jest.mock('react/react.shared-subset', () => {
const resolvedEntryPoint = resolveEntryFork(
require.resolve('react/src/ReactSharedSubset'),
global.__WWW__
);
return jest.requireActual(resolvedEntryPoint);
});
jest.mock('react-reconciler/src/ReactFiberReconciler', () => {
return jest.requireActual(
__VARIANT__