plugins
Remove composables from your client builds.
Unhead provides a Vite plugin to optimise your builds, by removing composables that aren't needed and simplifying your code.
While optional, it's recommended for most use cases to ensure Unhead runs optimally.
It will perform the following optimisations:
useServerHead
, useServerSeoMeta
)useSeoMeta
to raw useHead
(saves ~3kb)Install the addons package if you haven't already.
yarn add -D @unhead/addons
Add the Vite plugin to your build config.
// vite.config.ts
import { defineConfig } from 'vite'
import UnheadVite from '@unhead/addons/vite'
export default defineConfig({
plugins: [
UnheadVite(),
],
})
// webpack.config.ts
import { UnheadWebpack } from '@unhead/addons/webpack'
export default {
plugins: [
UnheadWebpack(),
],
}