Closed Jorckx closed 1 month ago
The error indicated that the type KirbySite
is missing. You've probably deleted the kirbySite
prefetch query from your Nuxt config: https://github.com/johannschopplich/kirby-nuxt-starterkit/blob/7464bc1e9d30038f4cf5ea37aa8763b7fe1b87df/nuxt.config.ts#L16. It is intended to fetch the site data at build-time to get a type-complete result when using the useSite
composable.
I recommend you add the kirbySite
prefetch query back.
Alternatively, you can make the type more generic:
export function useSite() {
return useState<Record<string, any>>('app.site', () => ({}))
}
It's happening at import type { KirbySite } from '#nuxt-kql'
in site.ts composable.
It's trying to import the type KirbySite
, not the prefetched siteQuery, or am I wrong? Somehow It can't find the type… In my nuxt.cofig I didn't change anything, the kirbySite is prefetched as it was. In addition this also affects all the useSite() composables since they 'can not be found'. It's very strange since I've build many sites using this your repository a template.
Yes, the KirbySite
type is inferred from the kirbySite
result object. You can check out .nuxt/module/nuxt-kql.ts
to see all your prefetched query results.
Have you run pnpm dev
, respectively npm run dev
depending on your package manager, once? Seems like the query hasn't been fetched. You need to run the dev server (or pnpm prepare
) once to generate this file. If you've freshly cloned the repo, the prefetchable query hasn't been fetched, so the type is missing.
Since recently I get this message within my site.ts composable. Also now when using your repository as a template. This also affects other composables which consume the useSite() composable. On my Imac however I do'nt have this problem. Can you help me figure out what's going wrong? I'm not aware of any changes that have led to this.