vite-plugin-relay icon indicating copy to clipboard operation
vite-plugin-relay copied to clipboard

Monorepo, Turborepo/Yarn Workspaces etc Support

Open mickdelaney opened this issue 1 year ago • 7 comments

Hi, Would it be possible to use this plugin in a monorepo setup ? Where we had an App containing graphql + Packages containing graphql ? Regards

mickdelaney avatar Aug 14 '22 13:08 mickdelaney

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

tobias-tengler avatar Aug 14 '22 14:08 tobias-tengler

https://github.com/mickdelaney/vite-relay-monorepo/blob/master/packages/ui/src/UserItem.tsx

mickdelaney avatar Sep 09 '22 20:09 mickdelaney

@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.

mickdelaney avatar Sep 09 '22 20:09 mickdelaney

There's a vite 2x version here https://github.com/mickdelaney/vite-relay-monorepo/pull/1 but i've not seen any difference

mickdelaney avatar Sep 09 '22 20:09 mickdelaney

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 avatar Sep 10 '22 05:09 oscartbeaumont

@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

mickdelaney avatar Sep 10 '22 09:09 mickdelaney

@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 ;-)

mickdelaney avatar Sep 10 '22 09:09 mickdelaney