Closed TLevesque closed 7 years ago
That's pretty weird, from the installation error you received, it looks like the compiler process isn't recognizing the node built-in modules (fs
, child_process
, etc). I'm guessing that you are importing/requiring some server-side code from a client-side module, and that's where the error is coming from.
If you haven't found a fix already, try replacing these two lines:
import { createLocalInterface } from 'apollo-local-query';
import * as graphql from 'graphql'; >> // I've also tried with: import graphql from 'graphql';
with require()
calls placed inside the if (isServer)
block. If you're using webpack it should be smart enough to not follow those requires when bundling your client side code.
Hope that helps, I'm closing since this looks like a build system problem but let me know if that helps to resolve the issue.
Hi, Apollo-local-query looks to be a great package for me to avoid go out and back through the networking stack, before I'm looking to gain some speed to render the data of my queries.
Unfortunately, I'm facing some troubles to install it in my context:
After doing the installation as presented in the readme, I'm getting the following error, which says that the dependencies related to the Koa server:
My working code before the installation was looking like this:
After the installation of apollo-local-query, it was looking like this:
For information, my schema.js is looking like this:
The file where I call the "initApollo" function to pass the ApolloClient to the Apollo Provider is looking like this:
And my server.js with Koa is looking like this:
Does anyone have an idea how to fix this issue? If someone succeed to give me some hint about how to fix it, I'm proposing myself to produce some extra documentation for apollo-local-query to illustrate the setup for this context! ;)
Thank for your help!