Cannot run React alongside SolidJS in Astro
The Error:
My Astro Config:
I don't believe it's an issue with my component. I'm trying to compile anything inside a "solid" directory (any of the parent directories that match that) with SolidJS, and everything else with react
4 Replies
Also yes I would rather run purely solidJS but my website is based on a template that has written a ton of code in React already, and I don't want to rewrite everything.
see also for info on using multiple JSX frameworks: https://docs.astro.build/en/guides/integrations-guide/react/#combining-multiple-jsx-frameworks
Update
I believe to have tracked it down to this line in my tsconfig.json:
I'm still stuck because I don't know how or if it's possible to make typescript work with solidjs and react together. Can anyone help me figure out how to fix this?
Try to add this a the top of your solidjs files:
/** @jsxImportSource solid-js */
https://docs.solidjs.com/configuration/typescript#configuring-typescriptI'm still getting mostly the same error:
Here's a minimal Astro setup. Check especially
1.
tsconfig.ts
2. astro.config.mjs
3. upgrade to latest versions of packages after project setup (in my case pnpm upgrade)
Note: I didn't even need the /** @jsxImportSource solid-js */
because probably astro adds this though its config.
https://github.com/madaxen86/astro-solid-reactGitHub
GitHub - madaxen86/astro-solid-react
Contribute to madaxen86/astro-solid-react development by creating an account on GitHub.