Is your feature request related to a problem? Please describe.
I have a boilerplate setup for my projects and codegen is a part of it. But when you start a new project codegen errors cause it is not able to find any gql files which makes sense, but I would like to silently ignore it and proceed with the remaining part of type generation.

Also, typedDocumentNode results in error when compiling if there are no operations since the import import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; exists but there are no operations which use the import as I am yet to write the operations:

Both the errors are valid cause there are no gql files in the specific directories which I typically add as and when I work on new operations. But, is there any way to ignore it and let the codegen generate types for the operations when they are available?
As of now, I am commenting out the documents statement in the codegen yaml file for every new service that I create and then uncommenting it when I have my new operation ready.
Describe the solution you'd like
Ability to silently ignore this error if no gql files/documents are present and then start generating types for them when they are available and only generating import statements if they are being used.
Describe alternatives you've considered
Commenting out the line in yaml till I have new operations.
Hi @tvvignesh !
I think the best way to go is to remove documents section from your boilerplate.
The reason we are throwing an error is because loading documents is not so simple- it might comes from a simple .graphql file, but there are cases we are extracting it from .js files as AST, or require file and look for exports. That's why it's important for us to notify the user that something is wrong with the configuration.
Regarding typed-document-node - I can apply a fix to remove the import in case there a are no operations, if that helps.
@dotansimha Makes sense. Just asking though, can't the error level be warning rather than terminating the codegen. That way, the user will still be notified but the codegen will still work even if there are no documents. I may be wrong, but if people prefer the codegen to fail on not finding documents, then maybe that can be a config.
Regarding typed-document-node - Please take your own time. I know you have a lot of priorities.
This could work. @ardatan maybe this is related to graphql-tools as well. I think the exception is originally coming from there.
What do you think?
Btw, I fixed the issue with in typed-document-node here: https://github.com/dotansimha/graphql-code-generator/pull/5035
@tvvignesh the fixed i mentioned above is available in @graphql-codegen/[email protected]
Awesome. Will try it out now.