diff --git a/app/pages/index.vue b/app/pages/index.vue index e42bac8ff..aab4010e4 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -51,6 +51,9 @@ const pageData = computed(() => page.value?.data) const { health } = useModuleHealth() // The health map loads on the client only: merge it once the modules section hydrated, or its server // HTML (without the health badges) would not match. +// The features fade in once their section hydrates, which happens as it scrolls into view. CSS, not +// ``: motion-v would be the homepage's largest preloaded dependency for this one effect. +const featuresRevealed = ref(false) const modulesHydrated = ref(false) const officialModulesWithHealth = computed(() => (officialModules.value || []).map(m => ({ ...m, health: (modulesHydrated.value && health.value[m.name]) || m.health || null })) @@ -257,29 +260,24 @@ useNuxtBirthday() root: 'bg-linear-to-b border-t border-default from-muted dark:from-muted/40 to-default', features: 'xl:grid-cols-4 lg:gap-10' }" + @hydrated="featuresRevealed = true" > @@ -623,3 +621,22 @@ useNuxtBirthday() + + diff --git a/nuxt.config.ts b/nuxt.config.ts index 2888d6c55..df0caac13 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -652,6 +652,20 @@ export default defineNuxtConfig({ component.global = false } } + }, + 'build:manifest': (manifest) => { + // `nuxt-workers` starts workers with `new Worker(new URL(…))`, which Vite lists as a script asset of + // the chunk that does it. The renderer then preloads it on every page: the 270 KB search worker, + // only needed once the palette opens, at a priority Lighthouse counts as render-blocking. + for (const chunk of Object.values(manifest)) { + for (const asset of chunk.assets ?? []) { + const resource = manifest[asset] + if (resource?.resourceType === 'script') { + resource.preload = false + resource.prefetch = false + } + } + } } }, agentDiscovery: {