ardatan / ardatan/graphql-tools
webpack-loader: allow loading multiple GraphQL Operations per file
- Dominant language
- TypeScript
- Stars
- 5.4k
- Forks
- 830
- Avg merge
- 10h 59m
- Merged PRs (30d)
- 45
Description
**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**
Contributor guide
Research direction
Start at the webpack-loader entry point and trace the error stating that only one GraphQL Operation is allowed per file. Compare its behavior with the linked graphql-tag/loader implementation and the @graphql-tools/jest-transform use case. Done means a .graphql file can expose multiple operations, including deleteMenuMutation and upsertMenuMutation, without that error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript, webpack
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100