-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use apollo client on the server? How to deal with explicit whatwg-fetch require? #1225
Comments
What's the problem you are experiencing? Does simply also importing |
Hmm. I think I see why this would work, actually. It looks like I'll try that! |
Yeah I think the polyfill situation is quite confusing, we're thinking of possibly removing all the polyfills for 1.0 and asking people to import the ones they want. On the other hand, it's nice that things "just work" on the client. |
@stubailo It's just a bit unintuitive in node, because you don't typically deal with globals. So seeing a After realizing this, I think the way it currently is is actually quite nice. The client will work in the browser out of the box, which is likely to cover most people's initial experiences with the apollo client. If we need (or want) to bring our own global An additional note in the docs about how In my case, I just made an incorrect assumption about how |
Yeah, it's a general issue with polyfills - they change something about the environment rather than actually exporting a function that is used. |
I was reading over #645. The issue is discussing how to appropriately change
createNetworkInterface
so that it works, out of the box, on node.js. The issue being that the networkInterface.ts file has a hard dependency on the browser-onlywhatwg-fetch
.Because that file still depends on that module, how have folks been doing server rendering so far? I'm trying to determine the best way to approach this.
We cannot simply include our own
fetch
implementation, becausenetworkInterface.ts
will always depend onwhatwg-fetch
. Are folks using webpack to resolve this to perhapsnode-fetch
on their server build? Is there a third party network interface that somebody has provided that uses a universal fetch module, instead?What are the options? Thanks.
The text was updated successfully, but these errors were encountered: