[Flight][Float] Preinitialize module imports during SSR (#27314)

Currently when we SSR a Flight response we do not emit any resources for
module imports. This means that when the client hydrates it won't have
already loaded the necessary scripts to satisfy the Imports defined in
the Flight payload which will lead to a delay in hydration completing.

This change updates `react-server-dom-webpack` and
`react-server-dom-esm` to emit async script tags in the head when we
encounter a modules in the flight response.

To support this we need some additional server configuration. We need to
know the path prefix for chunk loading and whether the chunks will load
with CORS or not (and if so with what configuration).

DiffTrain build for commit https://github.com/facebook/react/commit/701ac2e57290f913502c6012c15e815f412f84b7.
This commit is contained in:
gnoff
2023-09-27 16:58:18 +00:00
parent 4c5450952f
commit dfb03e8559
7 changed files with 9 additions and 9 deletions
@@ -23985,7 +23985,7 @@ function createFiberRoot(
return root;
}
var ReactVersion = "18.3.0-canary-49eba0193-20230926";
var ReactVersion = "18.3.0-canary-701ac2e57-20230927";
// Might add PROFILE later.
@@ -8620,7 +8620,7 @@ var devToolsConfig$jscomp$inline_1027 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-49eba0193-20230926",
version: "18.3.0-canary-701ac2e57-20230927",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1226 = {
@@ -8651,7 +8651,7 @@ var internals$jscomp$inline_1226 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-49eba0193-20230926"
reconcilerVersion: "18.3.0-canary-701ac2e57-20230927"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1227 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -9046,7 +9046,7 @@ var devToolsConfig$jscomp$inline_1069 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-49eba0193-20230926",
version: "18.3.0-canary-701ac2e57-20230927",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1267 = {
@@ -9077,7 +9077,7 @@ var internals$jscomp$inline_1267 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-49eba0193-20230926"
reconcilerVersion: "18.3.0-canary-701ac2e57-20230927"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1268 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -27,7 +27,7 @@ if (
}
"use strict";
var ReactVersion = "18.3.0-canary-49eba0193-20230926";
var ReactVersion = "18.3.0-canary-701ac2e57-20230927";
// ATTENTION
// When adding new symbols to this file,
@@ -616,4 +616,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-49eba0193-20230926";
exports.version = "18.3.0-canary-701ac2e57-20230927";
@@ -619,7 +619,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-49eba0193-20230926";
exports.version = "18.3.0-canary-701ac2e57-20230927";
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
@@ -1 +1 @@
49eba01930e9e1f331b34967fca65d5a0ba62846
701ac2e57290f913502c6012c15e815f412f84b7