cloudflare / pages-plugins

MIT License
57 stars 20 forks source link

Using vercel/og plugin with jsx and wrangler pages dev #71

Closed ericmatthys closed 1 week ago

ericmatthys commented 3 weeks ago

I am using vanilla Cloudflare Pages Functions with cloudflare pages dev and I'm experimenting with @vercel/og using the plug-in as documented in the Generate arbitrary images section. I have it working with plain js (React.createElement), but when using jsx like in the examples I get a parse error from es-module-lexer when miniflare is trying to get the entry points as the parser doesn't support jsx. Is there any way to use jsx / tsx without another framework that relies on building with vite or webpack? It seems to compile ok when using wrangler pages functions build, although it's not transforming the jsx into plain js.

ericmatthys commented 1 week ago

The error was the result of a misconfigured tsconfig.json that was preserving JSX.