apstanisic / zmaj

Zmaj is a headless CMS for managing database
https://zmaj.vercel.app
MIT License
5 stars 0 forks source link

Support adding external react code #29

Open apstanisic opened 1 year ago

apstanisic commented 1 year ago

Now it's not possible to add custom pages and components, since we are simply building vite app, and serving it as a static files. Simplest way to do this is for static part to be served normally, and user provided to be compiled with vite, and server as additional file user-custom.js, which admin panel can dynamically import.

Problem is that IDK if vite is to big dependecy. I do not want to that be user's responsability. Other option is maybe to use import { } from "react-dom/server" since then app can be rendered on server, maybe??? This is prettier since user is not providing path to file, but code directly

Edit: ReactDOM is not the way, since I still have to provide code to rehydrate on client. I thought that that is not needed with streaming rendered, but I was wrong. So that leaves Vite