Static GitHub Issues

[2722] How to add webpack-graphql-loader for fragments support

prev: Accessing Vuex getters with parameters
next: Error trying to include vue-goodshare

I am using nuxt-apollo and now I need to use fragments in .gql queries. Someone pointed out here to use graphql-loader to get access to fraqments. So based on this issue that's what I did

build: {
	vendor: ["axios"],
	postcss: {
		plugins: {
			"postcss-custom-properties": false
		}
	},
	extend(config, { isDev, isClient }) {
	    config.module.rules.push({
			test: /\.(graphql|gql)$/,
			exclude: /node_modules/,
			loader: "webpack-graphql-loader",
		});
	}
}

but its giving error

 error  in ./apollo/queries/newComment.gql

Module build failed: Syntax Error: Unexpected Name "var"

I really need to use it since there are a lot of repetitive queries in my project.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2363">#c2363</a>)</em></sub></div>