Open akoskm opened 2 years ago
@akoskm Were you able to solve this problem?
@Isomorpheus no, I didn't work on this. This is still an open issue in our project.
I will update you once we have a solution.
@akoskm Were you able to solve this problem?
@juancampuzano see my comment above.
I was facing the same issue and I solved it by using this library - https://github.com/evenchange4/graphql.macro
Hey @akoskm 👋
Would you be able to create a minimal, runnable reproduction of this issue? The webpack loader typically works well, so it would be helpful to understand if this issue is related to the way you've set up your project, or if there is some other change we need to be aware of in the library itself. Thanks!
I'm facing this issue as well. If i put the .graphql
file content directly inside the template literal tag gql
there will be no problem. But as soon as I put them in a separate .graphql
file the error SyntaxError: Unexpected identifier
will be shown.
I was facing the same issue and I solved it by using this library - https://github.com/evenchange4/graphql.macro
Could you explain how were you able to solve the problem by using graphql.macro
?
@BhavinPatel04
Fortunately, a solution found by using graphql-import-node
https://github.com/ardatan/graphql-import-node
api-extensions.graphql.ts
look like where you are importing .graphql
import gql from 'graphql-tag';
import 'graphql-import-node';
import q1 from "./q1-customizations.graphql";
export const commonApiExtensions = gql`
${q1}
`;
ts-node -r graphql-import-node/register ./src/index.ts
OR
node-dev -r graphql-import-node/register ./src/index.ts
I'm trying to import a
.graphql
file in a file calledmain.ts
.I set up the webpack loader according to the readme file https://github.com/apollographql/graphql-tag#webpack-loading-and-preprocessing
Here's how the file is imported:
and the error I'm getting:
The relevant part of my webpack configuration:
and here's the query: