harlan-zw / nuxt-site-config

Unifying site config with powerful and flexible APIs, for module authors and users.
https://nuxtseo.com/site-config
64 stars 3 forks source link

Hook `site-config:init` doesn't seem to exist. #29

Closed zAlweNy26 closed 1 month ago

zAlweNy26 commented 5 months ago

Describe the bug

If I upgrade to nuxt v3.11.2, the hook stops working, it doesn't seem to exist anymore. I initialize them in a server plugin like in the docs. The errors are: [vue-tsc] Argument of type '"site-config:init"' is not assignable to parameter of type 'HookKeys<NitroRuntimeHooks>'. [vue-tsc] Binding element 'siteConfig' implicitly has an 'any' type.

Reproduction

No response

System / Nuxt Info

- Operating System: Linux
- Node Version:     v20.10.0
- Nuxt Version:     3.11.2
- CLI Version:      3.11.1
- Nitro Version:    2.9.6
- Package Manager:  pnpm@8.10.0
- Builder:          -
- User Config:      typescript, future, ssr, css, devtools, modules, runtimeConfig, seo, schemaOrg, ogImage, auth, apiParty, security, i18n, imports, vue, nitro, app, colorMode, zodI18n, ui, routeRules, components, lodash, anime, $development, $test
- Runtime Modules:  magic-regexp/nuxt, @formkit/auto-animate/nuxt@0.8.2, @vueuse/nuxt@10.9.0, @pinia/nuxt@0.5.1, @hypernym/nuxt-anime@2.1.1, @sidebase/nuxt-auth@0.6.7, @nuxt/ui@2.15.2, @nuxt/image@1.5.0, nuxt-api-party@2.0.0, nuxt-lodash@2.5.3, nuxt-security@1.3.2, nuxt-zod-i18n@1.6.0, @nuxtjs/i18n@8.3.0, @nuxtjs/seo@2.0.0-rc.10, @nuxt/test-utils/module@3.12.1, @nuxt/devtools@1.1.5
- Build Modules:    -
harlan-zw commented 5 months ago

This is a TypeScript issue likely related to the fact that upgrading Nuxt will nuke the .nuxt folder which contains the runtime types.

If you re-run Nuxt or do nuxi prepare, it should restore the types.

Also worth noting that you need a tsconfig.json within your server folder specifically pointing at the Nitro types if you haven't already got one.

Feel free to just ignore these lines also though