graphql-tools icon indicating copy to clipboard operation
graphql-tools copied to clipboard

webpack-loader: allow loading multiple GraphQL Operations per file

Open ne0t3ric opened this issue 2 years ago • 1 comments

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

When I try to run tests with Jest, using @graphql-tools/jest-transform, I got an error with importing multiple GraphQL Operations from a .graphql file. The given error is :

GraphQL Webpack Loader allows only for one GraphQL Operation per file

import {deleteMenuMutation, upsertMenuMutation} from 'resources/graphql/menuMutations.graphql'

Describe the solution you'd like

Support the use of multiple GraphQL Operation per file , as it is intended in graphql-tag/loader https://github.com/apollographql/graphql-tag/blob/ac4f0da2a3bc07f33312e5af9707a5fb2034edcd/loader.js

Describe alternatives you've considered

Separate mutations def in multiple graphql files, but it's not practical for every uses.

Additional context

ne0t3ric avatar Nov 16 '22 14:11 ne0t3ric

And a typescript plugin similar to typescript-plugin-css-modules but for GraphQL it would be great, so as not to have errors when importing.

Related issue at graphql-tag: https://github.com/apollographql/graphql-tag/issues/582

alexojegu avatar Aug 06 '23 11:08 alexojegu