Gomah / nuxt-graphql-request

Easy Minimal GraphQL client integration with Nuxt.js.
https://nuxt-graphql-request.vercel.app
MIT License
194 stars 16 forks source link

Graphql-tag loader breaks when using this module #44

Closed Kameecoding closed 1 year ago

Kameecoding commented 2 years ago

I am trying to add this module to slowly replace the graphql-apollo client we have in our stack.

However I am getting stuck with the graphql-tag loader breaking when this module is added for some reason.

Webpack is configured to transpile graphql files

extend (config, { isClient }) {
    config.module.rules.push({
      test: /\.(graphql|gql)$/,
      exclude: /node_modules/,
      loader: 'graphql-tag/loader'
    })
}

If I only use graphql-request then everything works as expected I can use the query imported from a graphql file to make a request

when I try to add nuxt-graphql-request I get the error:

Module build failed (from ./node_modules/graphql-tag/loader.js):
GraphQLError: Syntax Error: Unexpected Name "var".

This error is especially baffling because we don't even have 'var' basically anywhere in the code base, only in CSS

I tried all sorts of combos, using it as dev/prod dependency, registering as module instead of buildModule, nothing works.

Kameecoding commented 2 years ago

So I managed to find in the source code that this module already sets up the graphql-tag transpiling, removing my own transpiling from my nuxt.config solved the issue, I think it would be good to explicitly mention this in the readme.