Graphql-tag: Problem with loader on webpack

Created on 7 Jun 2017  路  6Comments  路  Source: apollographql/graphql-tag

Hi guys I am having some problems trying to use the graphql-tag/loader with webpack on my project, I configure it but when I try to import the .graphql file keeps giving and error. It seems like babel-loader is trying to load the file instead of the graphql-tag/loader. I know it's not a bug I just want to know if somebody can help me to find what I'm doing wrong.
My config:

      {
        test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        loader: 'babel-loader',
      },
      {
        test: /\.(graphql|gql)$/,
        exclude: /node_modules/,
        loader: 'graphql-tag/loader',
      },

Error:
```/Users/matheus/Developer/rtr-frontend/node_modules/babel-core/lib/transformation/file/index.js:590
throw err;
^

SyntaxError: /Users/matheus/Developer/rtr-frontend/src/graphql/UpdateUser.gql: Unexpected token, expected ; (1:9)

1 | mutation updateUser($userId: String! $user: UserInput) {
| ^
2 | updateUser(id: $userId, user: $user) {
3 | id
4 | email
at Parser.pp$5.raise (/Users/matheus/Developer/rtr-frontend/node_modules/babylon/lib/index.js:4373:13)
```

Most helpful comment

Can anyone give some context to what was referenced in the Apollo Slack for those of us not in that Slack group please?

All 6 comments

@matheusrocha89 as we determined on the apollo slack, this was a webpack issue, not a graphql-tag issue

Ok @jnwng

@jnwng can you provide a link to the apollo slack chat? I'm experiencing this issue and could use a little context. Thanks!

@jnwng I did some searching and I think this is the thread on the apollo slack you are referring to? I see this is a while back, but do you by chance have the react app you tested with? It seems the cause was suspected, but hard to confirm since your app is not available as a control for comparison.

Can anyone give some context to what was referenced in the Apollo Slack for those of us not in that Slack group please?

if this is a webpack issue did anyone create a webpack issue for this?

Was this page helpful?
0 / 5 - 0 ratings