Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support array of documents from custom loader #6133

Open
jlitola opened this issue May 3, 2024 · 0 comments
Open

Support array of documents from custom loader #6133

jlitola opened this issue May 3, 2024 · 0 comments

Comments

@jlitola
Copy link

jlitola commented May 3, 2024

Is your feature request related to a problem? Please describe.

I need to support multiple GraphQL schemas in frontend, and need to implement custom loader to pick correct GraphQL operations. However, I'm now stuck as GraphQL codegen uses @graphql-tools/load, and it's custom loader support doesn't allow me to return multiple documents from the loader. If i combine all operations from different files into single document, then GraphQL codegen generated code wrong.

Describe the solution you'd like

collectCustomLoader could check if result of running loader is an array, and run addResultOfCustomLoader for each of the items.

Describe alternatives you've considered

Currently I don't have workaround for this.

Additional context

I have defined loader like below. Additionally it would be very helpful if you could specify function as loader instead of needing to go via JS file.

			documents: {
				"src/**/*.{ts,tsx}": {
					loader: "./my-custom-loader.js"
				}
			},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant