vite-plugin-relay
vite-plugin-relay copied to clipboard
Monorepo, Turborepo/Yarn Workspaces etc Support
Hi, Would it be possible to use this plugin in a monorepo setup ? Where we had an App containing graphql + Packages containing graphql ? Regards
I haven't tried it yet, but packages containing graphql
tagged literals should be correctly transformed by this plugin.
If you start a new project, just be aware that the plugin currently doesn't support Vite 3. I have already created a PR to add support, but it has yet to be merged: https://github.com/oscartbeaumont/vite-plugin-relay/pull/424
If you want to go ahead with Vite 3, you can install the package from my branch directly for now:
yarn add vite-plugin-relay@https://github.com/tobias-tengler/vite-plugin-relay#tte/fix-plugin
The concrete installation instructions are here
https://github.com/mickdelaney/vite-relay-monorepo/blob/master/packages/ui/src/UserItem.tsx
@oscartbeaumont i've added an example using turborepo + vite + relay + vite-plugin-relay
i've personally ended up (in a large monrepo) using tsup + babel for packages, but i've lost HMR as a result. so would be great to get an idea how to make this work.
There's a vite 2x version here https://github.com/mickdelaney/vite-relay-monorepo/pull/1 but i've not seen any difference
I am not using Relay in any projects currently so this plugin has been very low on my list of priorities. @tobias-tengler has done some great stuff to upgrade it which I just release to pnpm so give it a shot.
@oscartbeaumont thanks.
for anyone else coming here in a similar situation, this setup works by manually plugging in esbuild-babel into packages
https://github.com/mickdelaney/relay-recoil-post
@tobias-tengler if you have some time next week i'd love to know how I can help out here. i'm also using this with Hotchocolate btw ;-)