You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Float][Fizz][Static] add importMap option to Fizz and Static server renderers (#27260)
Import maps need to be emitted before any scripts or preloads so the
browser can properly locate these resources.
Unlike most scripts, importmaps are singletons meaning you can only have
one per document and they must appear before any modules are loaded or
preloaded. In the future there may be a way to dynamically add more
mappings however the proposed API for this seems likely to be a
javascript API and not an html tag.
Given the unique constraints here this PR implements React's support of
importMaps as the following
1. an `importMap` option accepting a plain object mapping module
specifier to path is accepted in any API that renders a preamble (head
content). Notably this precludes resume rendering because in resume
cases the preamble should have already been produced as part of the
prerender step.
2. the importMap is stringified and emitted as a `<script
type="importmap">...</script>` in the preamble.
3. the importMap is escaped identically to how bootstrapScriptContent is
escaped, notably, isntances of `</script>` are escaped to avoid breaking
out of the script context
Users can still render importmap tags however with Float enabled this is
rather pointless as most modules will be hoisted above the importmap
that is rendered. In practice this means the only functional way to use
import maps with React is to use this config API.
DiffTrain build for commit 9d4582d.
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -23977,7 +23977,7 @@ function createFiberRoot(
23977
23977
return root;
23978
23978
}
23979
23979
23980
-
var ReactVersion = "18.3.0-canary-b4cdd3e89-20230823";
23980
+
var ReactVersion = "18.3.0-canary-9d4582dff-20230824";
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -8612,7 +8612,7 @@ var devToolsConfig$jscomp$inline_1029 = {
8612
8612
throwError("TestRenderer does not support findFiberByHostInstance()");
8613
8613
},
8614
8614
bundleType: 0,
8615
-
version: "18.3.0-canary-b4cdd3e89-20230823",
8615
+
version: "18.3.0-canary-9d4582dff-20230824",
8616
8616
rendererPackageName: "react-test-renderer"
8617
8617
};
8618
8618
varinternals$jscomp$inline_1228={
@@ -8643,7 +8643,7 @@ var internals$jscomp$inline_1228 = {
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9038,7 +9038,7 @@ var devToolsConfig$jscomp$inline_1071 = {
9038
9038
throwError("TestRenderer does not support findFiberByHostInstance()");
9039
9039
},
9040
9040
bundleType: 0,
9041
-
version: "18.3.0-canary-b4cdd3e89-20230823",
9041
+
version: "18.3.0-canary-9d4582dff-20230824",
9042
9042
rendererPackageName: "react-test-renderer"
9043
9043
};
9044
9044
varinternals$jscomp$inline_1269={
@@ -9069,7 +9069,7 @@ var internals$jscomp$inline_1269 = {
0 commit comments