Closed asonnleitner closed 4 weeks ago
Is there something in particular that didn't work for you? I have successfully used this module with layers before, even having different query files per layer.
@dulnan I believe I had some issues with the GraphQL files when using fragment imports. I had them stored at both the root level and the project level, but the imports did not resolve correctly.
Ah I see. I will setup a playground that uses layers to try to debug this. What should work is to always reference the fragment imports by their full path.
I'm also currently working on a feature to automatically inline fragments without the need to specify an import. That should also fix the issue with layers, as long as there are no two fragments with the same name in multiple layers or layer and root.
@dulnan That sounds awesome! 🔥
@dulnan Here is something I worked in the past https://github.com/dulnan/nuxt-graphql-middleware/pull/33, which removes @graphql-fragment-import/lib
and use a typescript module I wrote, it is also more performant and uses new newer JS API, like function generators, Maps and Sets. Feel free to make any changes.
Both your refactored fragment import and the new "auto inline fragments" feature have been released in 4.1.0: https://nuxt-graphql-middleware.dulnan.net/features/fragments.html#automatic-import
I still need to add a "layers playground", so I'll keep this issue open for the time being.
It would be cool if graphql files would support nuxt layers