tobias-tengler / create-relay-app

Relay setup automation for CRA, Next.js and Vite
MIT License
77 stars 3 forks source link

Add option to integrate with vite-plugin-relay-lite #12

Closed XiNiHa closed 2 years ago

XiNiHa commented 2 years ago

vite-plugin-relay-lite has some advantages like providing smooth integration with the Relay compiler, and transforming the code really fast. While I think it shouldn't be recommended in general (since it doesn't actually parse AST, which makes it break on some cases), I believe it's worth adding an option for it.

tobias-tengler commented 2 years ago

I don't think I'll add support for it. I'm already having trouble with vite-plugin-relay, since it does not support Vite 3. Adding another library that might break in the future, increases the maintainance cost on this project, which I don't want to happen. The Vite + Relay community also seems to be rather small (not even 70 combined stars for both libraries), so introducing this dependency doesn't seem worth it to me. The only real selling point over vite-plugin-relay is being faster, while being higher risk in all other areas, e.g. custom config resolution, no AST traversal as you mentioned and possibly slight differences to how the official babel-plugin-relay and the relay-compiler works now (and possibly in the future). I like the adapter approach of vite-plugin-relay more, since even though it might not be as fast, it's consistent to the official implementation. I also submitted a PR to it where I added Vite 3 support and moved all of the configuration of babel-plugin-relay out of the code and made the dependency a peerDependency, so it's truly just an adapter and everything around configuration and updating is the responsibility of the user.

Sorry for the bad news. I hope my stance is reasonable. Forking the project and introducing support yourself is of course always an option :)