From 5f176b1a96a6c61cdb11b47d5a3b888d8862d459 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 4 Sep 2023 16:43:50 +0100 Subject: [PATCH] fix(nuxt): render inlined ssr styles before stylesheets (#22986) --- packages/nuxt/src/core/runtime/nitro/renderer.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/nuxt/src/core/runtime/nitro/renderer.ts b/packages/nuxt/src/core/runtime/nitro/renderer.ts index 13c053a3ca..6c58b90e64 100644 --- a/packages/nuxt/src/core/runtime/nitro/renderer.ts +++ b/packages/nuxt/src/core/runtime/nitro/renderer.ts @@ -22,7 +22,7 @@ import type { HeadEntryOptions } from '@unhead/schema' import { defineRenderHandler, getRouteRules, useRuntimeConfig, useStorage } from '#internal/nitro' import { useNitroApp } from '#internal/nitro/app' -import type { Link, Script } from '@unhead/vue' +import type { Link, Script, Style } from '@unhead/vue' import { createServerHead } from '@unhead/vue' // @ts-expect-error virtual file import unheadPlugins from '#internal/unhead-plugins.mjs' @@ -349,12 +349,12 @@ export default defineRenderHandler(async (event): Promise ({ rel: 'stylesheet', href: renderer.rendererContext.buildAssetsURL(resource.file) }) - ), - style: inlinedStyles + ) }, headEntryOptions) if (!NO_SCRIPTS) { @@ -495,7 +495,7 @@ function renderHTMLDocument (html: NuxtRenderHTMLContext) { ` } -async function renderInlineStyles (usedModules: Set | string[]) { +async function renderInlineStyles (usedModules: Set | string[]): Promise { const styleMap = await getSSRStyles() const inlinedStyles = new Set() for (const mod of usedModules) {