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

load babel options in graphql-tag-pluck #5869

Open
rwe opened this issue Feb 1, 2024 · 0 comments
Open

load babel options in graphql-tag-pluck #5869

rwe opened this issue Feb 1, 2024 · 0 comments

Comments

@rwe
Copy link

rwe commented Feb 1, 2024

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

graphql-codegen was silently ignoring source files and not extracting documents.
I was able to track it down to our use of the parser plugin explicitResourceManagement, which is declared in the babelrc.

But it turns out that graphql-tag-pluck hardcodes babel options based on file extensions 1, and passes those directly to parse() 2 without possibility of intervention. It ignores existing babel configuration.

Describe the solution you'd like

graphql-tag-plug should attempt to use babel.loadPartialConfig 3, and use that if it succeeds.

Describe alternatives you've considered

Alternatively, allow passing a list of plugins or babel options overrides through. Note that this might require plumbing up a few levels if interfaces through CodeFileLoader and graphql-codegen itself to make sure it's properly exposed.

Footnotes

  1. https://github.com/ardatan/graphql-tools/blob/848de826f21fddd48fac1a93f6d616df6a135c08/packages/graphql-tag-pluck/src/config.ts#L10

  2. https://github.com/ardatan/graphql-tools/blob/848de826f21fddd48fac1a93f6d616df6a135c08/packages/graphql-tag-pluck/src/index.ts#L248

  3. https://babeljs.io/docs/babel-core#loadoptions

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