diff --git a/packages/nuxt/src/core/runtime/nitro/renderer.ts b/packages/nuxt/src/core/runtime/nitro/renderer.ts index f706de8bfb..a5160f0898 100644 --- a/packages/nuxt/src/core/runtime/nitro/renderer.ts +++ b/packages/nuxt/src/core/runtime/nitro/renderer.ts @@ -17,7 +17,7 @@ import destr from 'destr' import { getQuery as getURLQuery, joinURL, withoutTrailingSlash } from 'ufo' import { renderToString as _renderToString } from 'vue/server-renderer' import { createHead as createServerHead, propsToString, renderSSRHead } from '@unhead/vue/server' -import type { Head, HeadEntryOptions, Link, ResolvedHead, Script, Style } from '@unhead/vue/types' +import type { Head, HeadEntryOptions, Link, Script, Style } from '@unhead/vue/types' import { resolveUnrefHeadInput } from '@unhead/vue' import { defineRenderHandler, getRouteRules, useNitroApp, useRuntimeConfig, useStorage } from 'nitro/runtime' diff --git a/packages/nuxt/src/head/plugins/unhead-imports.ts b/packages/nuxt/src/head/plugins/unhead-imports.ts index 1819a831c1..142e2fbdcf 100644 --- a/packages/nuxt/src/head/plugins/unhead-imports.ts +++ b/packages/nuxt/src/head/plugins/unhead-imports.ts @@ -43,9 +43,7 @@ export const UnheadImportsPlugin = (options: UnheadImportsPluginOptions) => crea } const s = new MagicString(code) const importsToAdd: ImportSpecifier[] = [] - // Without setup function, vue compiler does not generate __name parseAndWalk(code, id, function (node) { - // find any imports from @unhead/vue, swap the matchImports for an import from #app/composables/head if (node.type === 'ImportDeclaration' && [UnheadVue, '#app/composables/head'].includes(String(node.source.value))) { importsToAdd.push(...node.specifiers as ImportSpecifier[]) const { start, end } = withLocations(node) @@ -62,7 +60,6 @@ export const UnheadImportsPlugin = (options: UnheadImportsPluginOptions) => crea } s.prepend(`import { ${toImports(importsFromUnhead).join(', ')} } from '#app/composables/head'\n`) } - // if there are imports from #app/composables/head, add an import from @unhead/vue if (importsFromHead.length) { s.prepend(`import { ${toImports(importsFromHead).join(', ')} } from ${JSON.stringify(UnheadVue)}'\n`) }