Open philefstat opened 1 year ago
can you share your sanity.config.ts?
@philefstat or anyone else who runs into this: I'm using this with NextJS 13 and the app
directory, but sanity-codegen looks in src
by default. The fix for me was to use the include
option in the sanity-codegen.config.ts
file. My config now looks like this:
import { SanityCodegenConfig } from '@sanity-codegen/cli'
const config: SanityCodegenConfig = {
sanityConfigPath: './sanity.config.ts',
output: 'types/sanity-codegen/sanity-codegen.d.ts',
include: ['./app/**/*.{js,jsx,ts,tsx}'],
}
export default config
I'm getting queries autogenerated now. Great work @ricokahler !
It's in the docs but kind of snuck up on me. Hope this helps!
I've both the main version and v1 alpha, but no matter what I try, I get
Even with a simple groq query in a typescript file:
I've also tried wrapping it in
codegen
as follows:but I get the same result. How does sanity-codegen find queries / how can I point it in the direction of my queries so that the types are generated for them?