Exclude package from codegen
See original GitHub issueHi,
I’d like to be able to exclude a package from codegen. Currently, I have a project that also uses shopify api for the shop pages. However, codegen crashes because the schema is different from prisma’s schema.
I don’t want to build a full-fledged ecommerce functionality into my app, and would prefer to use shopify api for the few products the app offers. And use urql/react-query to access only on the shop/cart/checkout page. I can confirm using urql or react-query or swr works for my use case. But codegen crashes.
I’ve tried overwriting the documents field in the graphql.config.js file to only include documents from /web and /api, as I have all the schema/gql for shopify in /packages/shop. And I intentionally don’t want to merge schemas or redefine queries/mutations/resolver for shopify
But this does not work, as it ignores the document field and still manages to find the shop queries and mutations in /packages/shop and crashes.
I codegen for shopify as well, and can confirm it works, as I only include documents in the /packages/shop and point my codegen script to call a local config in /packages/shop. But updating the documents fields in the root graphql.config.js does not work and does not successfully exclude /packages/shop.
Does rw/types actually read the local graphql.config.js? If yes, can we provide a way to overwrite it or extend as you would say webpack.config? Or can we call rw types
with a custom config file and provide guidance on extending default config.
I know graphql config also recently added the concept of projects. So that might be another approach to isolating the config for @graphql/codegen.
Thank you.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Thanks for the update! And definitely curious to learn more about what you’re building — if/when you’re up for it, we ❤️ posts in the Forum Show & Tell. (And/or I’d welcome a DM anytime.)
As for schema stitching, looping in @dthyresson and @urigo --> This seems like a possible case for GraphQL Mesh (or a subset of tools). I’m just not sure about the integration points with Redwood. But it would be rad to figure it out!
I tried Mesh maybe a year or so ago but not recently.
@thedavidprice in our experiment list (can we start one?) I’d add this together with the Redis cache and live query GraphQL investigations id line to do.