SolidJSS
SolidJSโ€ข2y agoโ€ข
1 reply
alexamy

React is not defined when using custom server directory for Vite

Hi! If I use custom directory on the same level as src for dev mode in Vite & Solid setup, I get React is not defined error.

Steps to reproduce:
1. Create new Solid project with npm create vite@latest
2. Move index.html, index.tsx to separate dev directory
2a. Change import in index.tsx to point to file from src directory
2b. Add dev directory to tsconfig.json include.
3. Run vite dev mode: vite serve dev

Expected:
Web page is loaded and working correctly.

Actual:
React is not defined in solid-js_web.

Example repo:
https://github.com/alexamy/solid-custom-serve-directory
Was this page helpful?