I created a React project with Vite, and I’d like to use Apollo extension to get autocompletion for my GraphQL queries.
I created a apollo.config.js
config file at the root directory, with the indicated configuration :
module.exports = {
client: {
service: {
name: "my-graphql-app",
url: "http://localhost:4000/graphql",
},
},
};
But since my React app is of type : module
, i get the error : module not found
, and from the apollo extension , i get the error Service stats could not be loaded. This may be because you're missing an apollo.config.js file or it is misconfigured.
I tried to just export it like this :
const client = {
service: {
name: "my-graphql-app",
url: "http://localhost:4000/graphql",
},
};
export default client;
And later import it in my App.js
, and the error about the missing config file is gone, but I get no autocompletion.
If I use it with a React app bundled with CRA, works just fine.
Thanks in advance for any help or hints!