sanity
sanity copied to clipboard
Type generation incompatible with Astro
Describe the bug
I'm trying to use GROQ typegen in my Astro project, but it doesn't recognize the JSX-in-frontmatter syntax and mistakenly thinks its all errors, for example:
src/pages/about.astro: `import` can only be used in `import()` or `import.meta`. (2:0)
1 | ---
> 2 | import Layout from '../layouts/BlogPost.astro';
Using the same code in a standard JSX format produces expected results.
To Reproduce
Steps to reproduce the behavior:
- Follow Astro + Sanity getting started guide.
- Create
sanity-typegen.json
to include.astro
files in thepath
search glob. - Run
sanity schema extract && sanity typegen generate
.
Expected behavior
The types should generate without error.
Which versions of Sanity are you using?
Run sanity versions
in the terminal and copy-paste the result here.
@sanity/cli (global) 3.46.1 (up to date)
@sanity/astro 3.1.3 (up to date)
@sanity/image-url 1.0.2 (up to date)
@sanity/types 3.46.1 (up to date)
@sanity/vision 3.46.1 (up to date)
sanity 3.46.1 (up to date)
What operating system are you using?
macOS 14.5
Which versions of Node.js / npm are you running?
Run npm -v && node -v
in the terminal and copy-paste the result here.
10.2.4
v18.19.1