Home

Issue: 2722

How to add webpack-graphql-loader for fragments support

[issue link]

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.

This question is available on Nuxt.js community (#c2363)