Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export function createResponseState(
? 'use-credentials'
: '';

preloadBootstrapScript(resources, src, nonce, integrity);
preloadBootstrapScript(resources, src, nonce, integrity, crossOrigin);

bootstrapChunks.push(
startScriptSrc,
Expand Down Expand Up @@ -322,7 +322,7 @@ export function createResponseState(
? 'use-credentials'
: '';

preloadBootstrapModule(resources, src, nonce, integrity);
preloadBootstrapModule(resources, src, nonce, integrity, crossOrigin);

bootstrapChunks.push(
startModuleSrc,
Expand Down Expand Up @@ -5425,6 +5425,7 @@ function preloadBootstrapScript(
src: string,
nonce: ?string,
integrity: ?string,
crossOrigin: ?string,
): void {
const key = getResourceKey('script', src);
if (__DEV__) {
Expand All @@ -5444,6 +5445,7 @@ function preloadBootstrapScript(
as: 'script',
nonce,
integrity,
crossOrigin,
};
const resource: PreloadResource = {
type: 'preload',
Expand All @@ -5465,6 +5467,7 @@ function preloadBootstrapModule(
src: string,
nonce: ?string,
integrity: ?string,
crossOrigin: ?string,
): void {
const key = getResourceKey('script', src);
if (__DEV__) {
Expand All @@ -5483,6 +5486,7 @@ function preloadBootstrapModule(
href: src,
nonce,
integrity,
crossOrigin,
};
const resource: PreloadResource = {
type: 'preload',
Expand Down
14 changes: 13 additions & 1 deletion packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3865,7 +3865,19 @@ describe('ReactDOMFizzServer', () => {

expect(getVisibleChildren(document)).toEqual(
<html>
<head />
<head>
<link rel="preload" href="foo" as="script" />
<link rel="preload" href="bar" as="script" />
<link rel="preload" href="baz" as="script" crossorigin="" />
<link rel="preload" href="qux" as="script" crossorigin="" />
<link rel="modulepreload" href="quux" />
<link rel="modulepreload" href="corge" />
<link
rel="modulepreload"
href="grault"
crossorigin="use-credentials"
/>
</head>
<body>
<div>hello world</div>
</body>
Expand Down