Django with React using Vite and Inertia

Inspired by https://github.com/mujahidfa/inertia-django-vite-vue-minimal
I created https://github.com/anjanesh/inertia-django-vite-react-minimal
to use React (19.0.0) in Django (5.1.5) via Inertia (2.0) but :

When I run npm run dev and python manage.py runserver and goto localhost:8000, I get in the browser :

Uncaught (in promise) Error: @vitejs/plugin-react can't detect preamble. Something is wrong. See https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201 at Index.tsx:1:26

enter image description here

Works in production though - npm run build and python manage.py collectstatic

Вернуться на верх