Urql: 'fetch is not defined'

Created on 8 Jun 2019  路  2Comments  路  Source: FormidableLabs/urql

Hi 馃憢

I was trying urql with NextJS and I'm getting fetch is not defined in the method executeQuery in file urql.js.

Installed isomorphic-unfetch hoping it would solve the problem but it persists.
What am i missing? 馃

Most helpful comment

We don't have any hard dependency on fetch to decrease our bundle size, since ultimately exchanges like the fetchExchange are optional.

But since isomorphic-unfetch is just a polyfill you can apply it before creating your urql client 馃憤

As described in their docs:

import 'isomorphic-unfetch';

https://www.npmjs.com/package/isomorphic-unfetch

Hope this helps 馃憤

All 2 comments

We don't have any hard dependency on fetch to decrease our bundle size, since ultimately exchanges like the fetchExchange are optional.

But since isomorphic-unfetch is just a polyfill you can apply it before creating your urql client 馃憤

As described in their docs:

import 'isomorphic-unfetch';

https://www.npmjs.com/package/isomorphic-unfetch

Hope this helps 馃憤

Yep that works. Thanks 馃檹

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nicollecastrog picture nicollecastrog  路  3Comments

wodnjs6512 picture wodnjs6512  路  3Comments

narinluangrath picture narinluangrath  路  3Comments

Andrew-Talley picture Andrew-Talley  路  4Comments

capaj picture capaj  路  5Comments