Joint session with Vercel: How to build intelligent storefronts (May 15th)

Failed to parse JSX in blockContent.js - need .jsx extension for Sanity v3

3 repliesLast updated: Nov 29, 2025

Hi! Trying to migrate a project from v2 to v3 for the first time. My schemas/blockContent.js has this line in it with a tailwind reference:

const smallH2Style = props => (

<span className="py-4">{props.children}</span>

)

Which gives me this error:


[plugin:vite:import-analysis] Failed to parse source for import analysis because the content contains invalid JS syntax. If you are using JSX, make sure to name the file with the .jsx or .tsx extension.

I suspect this is because of the missing access to the definition of the py-4 class? Is this assumtion correct? Or is it something else happening here? The Sanity Studio folder is located inside a
Next.js project folder that has tailwind installed as a dependency - How would I go about linking that Tailwind instance to blockContent.js?
AI Update

The error you're encountering is actually exactly what it says - Vite (which powers Sanity Studio v3) requires files containing JSX syntax to have a .jsx or .tsx extension. This isn't about Tailwind classes at all!

The Solution:

Simply rename your file from schemas/blockContent.js to schemas/blockContent.jsx (or .tsx if you're using TypeScript). This will immediately resolve the Vite parsing error.

About the Tailwind Classes:

Your assumption about the py-4 class isn't quite right - the error happens during the build/parse phase before the browser even tries to apply styles. However, you'll still want to ensure Tailwind is properly configured for your Sanity Studio to actually see those styles applied.

Setting up Tailwind in Sanity Studio v3:

Since your Studio is inside a Next.js project that already has Tailwind installed, you have a couple of options:

According to the Sanity documentation on Tailwind CSS, when using Tailwind with Sanity, you should extend the built-in Vite config in sanity.cli.ts rather than creating a separate config file.

V2 to V3 Migration Note:

This is one of those gotchas when migrating from v2 to v3 - Studio v3 uses Vite as its build tool, which has stricter requirements about file extensions for JSX. In v2, the build system was more lenient about this. The Parts System has been completely replaced in v3 with a JavaScript-based configuration approach, and Vite enforces proper file extensions for parsing.

Bottom Line: Rename to .jsx first to fix the immediate error, then ensure your Tailwind configuration scans your Studio files to apply the styles!

Show original thread
3 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Related contributions