graphql-let icon indicating copy to clipboard operation
graphql-let copied to clipboard

Can `graphql-let` be used with Vite?

Open alex-vladut opened this issue 3 years ago • 1 comments

I would be curious if it is possible to use the loader with Vite in any way? Otherwise, does anyone know of an equivalent library to generate typed document nodes for Vite? Thanks

alex-vladut avatar Nov 11 '22 15:11 alex-vladut

In case anyone else finds this approach useful, I played with it and adapted the @vitejs/plugin-react to scan graphql files and apply the graphql-let loader to generate the types. It seems to do a good enough job so far, here you can find a small gist with what the config looks like: https://gist.github.com/alex-vladut/98db99556e1588449ae1457d68a7fb19

It is also available as an NPM package https://www.npmjs.com/package/@lente/vite-plugin-graphql

alex-vladut avatar Dec 11 '22 19:12 alex-vladut