diff --git a/packages/nuxt/src/head/module.ts b/packages/nuxt/src/head/module.ts index cb41b7bb2c..f9d6514669 100644 --- a/packages/nuxt/src/head/module.ts +++ b/packages/nuxt/src/head/module.ts @@ -12,6 +12,10 @@ export default defineNuxtModule({ }, async setup (options, nuxt) { const runtimeDir = resolve(distDir, 'head/runtime') + + // Transpile @unhead/vue + nuxt.options.build.transpile.push('@unhead/vue') + const isNuxtV4 = nuxt.options.future?.compatibilityVersion === 4 // Register components const componentsPath = resolve(runtimeDir, 'components') diff --git a/packages/vite/src/server.ts b/packages/vite/src/server.ts index 541dac05f0..51bb3470c1 100644 --- a/packages/vite/src/server.ts +++ b/packages/vite/src/server.ts @@ -122,7 +122,7 @@ export async function buildServer (ctx: ViteBuildContext) { if (Array.isArray(serverConfig.ssr!.external)) { serverConfig.ssr!.external.push( // explicit dependencies we use in our ssr renderer - these can be inlined (if necessary) in the nitro build - 'unhead', 'unctx', 'h3', 'devalue', '@nuxt/devalue', 'radix3', 'rou3', 'unstorage', 'hookable', + 'unhead', '@unhead/vue', 'unctx', 'h3', 'devalue', '@nuxt/devalue', 'radix3', 'rou3', 'unstorage', 'hookable', // ensure we only have one version of vue if nitro is going to inline anyway ...((ctx.nuxt as any)._nitro as Nitro).options.inlineDynamicImports ? ['vue', '@vue/server-renderer', '@unhead/vue'] : [], // dependencies we might share with nitro - these can be inlined (if necessary) in the nitro build