Graphql-tag: Circular files import causing "Unexpected Name "undefined""

Created on 28 May 2019  路  5Comments  路  Source: apollographql/graphql-tag

Hi,

I have a _Syntax Error: Unexpected Name "undefined"_ error when I have circular imports between fragments files.
I don't have circular dependencies on my fragment, just with the files import.

For example:

```
// fragmentA.ts

import gql from "graphql-tag";
import {fragmentB} from "./fragmentB";

export const fragmentA = gqlfragment aFields on A { ...bFields } ${fragmentB};


// fragmentB.ts

import gql from "graphql-tag";
import {fragmentA} from "./fragmentA";

export const fragmentB = gqlfragment bFields on B { id } ;

export const fragmentC = gqlfragment cFields on C { ...aFields } ${fragmentA};

```
I have now an error on fragmentA cause of fragmentC.

I reproduce this example on this repo: https://github.com/pwortham/graphql-fragments

Most helpful comment

I also ran into this today. Is there a fix planned?

All 5 comments

Will this be addressed?

I also ran into this today. Is there a fix planned?

Ran into this while trying to use Fragments with react Context api which is causing "circular" imports while trying to run Jest tests

Did someone found any workaround to the problem?

+1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dallonf picture dallonf  路  6Comments

felixfbecker picture felixfbecker  路  6Comments

matheusrocha89 picture matheusrocha89  路  6Comments

good-idea picture good-idea  路  3Comments

chris-verclytte picture chris-verclytte  路  7Comments