mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-16 13:48:13 +00:00
perf(nuxt): tree-shake server composables + prefer server head (#19576)
This commit is contained in:
parent
6d79b71588
commit
d2f0b22632
@ -36,6 +36,11 @@ export default defineNuxtModule({
|
||||
})
|
||||
}
|
||||
|
||||
// allow @unhead/vue server composables to be tree-shaken from the client bundle
|
||||
nuxt.options.optimization.treeShake.composables.client['@unhead/vue'] = [
|
||||
'useServerHead', 'useServerSeoMeta', 'useServerHeadSafe'
|
||||
]
|
||||
|
||||
addImportsSources({
|
||||
from: '@unhead/vue',
|
||||
// hard-coded for now we so don't support auto-imports on the deprecated composables
|
||||
|
@ -1,10 +1,11 @@
|
||||
import { createHead } from '@unhead/vue'
|
||||
import { createHead as createClientHead, createServerHead } from '@unhead/vue'
|
||||
import { renderSSRHead } from '@unhead/ssr'
|
||||
import { defineNuxtPlugin } from '#app/nuxt'
|
||||
// @ts-expect-error untyped
|
||||
import { appHead } from '#build/nuxt.config.mjs'
|
||||
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
const createHead = process.server ? createServerHead : createClientHead
|
||||
const head = createHead()
|
||||
head.push(appHead)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user