[Flight] Fix preload as attribute for stylesheets (#34760)

Follow-up to #34604. For a stylesheet, we need to render `<link
rel="preload" as="style" ...>`, and not `<link rel="preload"
as="stylesheet" ...>`.
([ref](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/rel/preload#what_types_of_content_can_be_preloaded))

fixes vercel/next.js#84569
This commit is contained in:
Hendrik Liebau 2025-10-10 21:40:56 +02:00 committed by GitHub
parent 8454a32f3c
commit d44659744f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -169,7 +169,7 @@ function processLink(props: Object, formatContext: FormatContext): void {
return;
}
case 'stylesheet': {
preload(href, 'stylesheet', {
preload(href, 'style', {
crossOrigin: props.crossOrigin,
integrity: props.integrity,
nonce: props.nonce,

View File

@ -2087,7 +2087,7 @@ describe('ReactFlightDOM', () => {
media="(orientation: landscape)"
/>
<link rel="modulepreload" href="module-resource" />
<link rel="preload" as="stylesheet" href="css-resource" />
<link rel="preload" as="style" href="css-resource" />
</head>
<body>
<p>hello world</p>