Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(nuxt): don't tree-shake useServerHead in dev #26421

Merged
merged 3 commits into from
Mar 21, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions packages/nuxt/src/head/module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { resolve } from 'pathe'
import { addComponent, addImportsSources, addPlugin, addTemplate, defineNuxtModule, tryResolveModule } from '@nuxt/kit'
import { defu } from 'defu'

Check failure on line 3 in packages/nuxt/src/head/module.ts

View workflow job for this annotation

GitHub Actions / code

'defu' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 3 in packages/nuxt/src/head/module.ts

View workflow job for this annotation

GitHub Actions / build

'defu' is declared but its value is never read.
danielroe marked this conversation as resolved.
Show resolved Hide resolved
import { distDir } from '../dirs'

const components = ['NoScript', 'Link', 'Base', 'Title', 'Meta', 'Style', 'Head', 'Html', 'Body']
Expand Down Expand Up @@ -29,9 +30,11 @@
}

// allow @unhead/vue server composables to be tree-shaken from the client bundle
nuxt.options.optimization.treeShake.composables.client['@unhead/vue'] = [
'useServerHead', 'useServerSeoMeta', 'useServerHeadSafe'
]
if (!nuxt.options.dev) {
nuxt.options.optimization.treeShake.composables.client['@unhead/vue'] = [
'useServerHead', 'useServerSeoMeta', 'useServerHeadSafe'
]
}

addImportsSources({
from: '@unhead/vue',
Expand Down