Multiple fragments per file
See original GitHub issueHello, thanks for a great package first of all!
I just found out that it doesn’t support multiple fragments import. Is it possible to fix it? From the source code, I see that the only reason is this line: https://github.com/detrohutt/babel-plugin-inline-import-graphql-ast/blob/master/plugin/multi-op.js#L19 If we would remove this check - it might do the trick. Unfortunately, as far as I can see, it will break backward compatibility in a sense if you have a fragment and an operation defined in a single file, the first operation should be returned as a default import. So we need also to change the default document determination algorithm to set up precedence of operations over fragments despite the ordering. Am I right?
Also, one minor thingy noted - would be nice to support an optional space between #
and import
. It was really tough to figure out why doesn’t it work.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
It works just awesomely! Thanks again!
Ah, you did mention all of that in the description. Sorry, it’s been a busy last few days. Depending on how much trouble I run into with v3.0.0, I may continue messing with it on the master branch. I was headed in the direction you mentioned, checking for files with only fragments, etc but it was adding more code than I wanted to and seemed a little overly complex/verbose (coding while tired) but I can probably clean it up when I’m not tired. Anyway, thanks for your patience and I’ll keep you updated on what I get going.