TallerWebSolutions / apollo-cache-instorage

Apollo Cache implementation that facilitates locally storing resources
MIT License
96 stars 11 forks source link

Usage in non-SSR apps #5

Closed yantakus closed 5 years ago

yantakus commented 5 years ago

Was this package tested with non-SSR apps? I tried this one as a drop-in replacement for apollo-cache-persist, but I get the following error:

ReferenceError: process is not defined

Module../node_modules/graphql/jsutils/instanceOf.mjs
node_modules/graphql/jsutils/instanceOf.mjs:1

> 1 | export default process && process.env.NODE_ENV !== 'production' ? // eslint-disable-next-line no-shadow
  2 | function instanceOf(value, constructor) {
  3 |   if (value instanceof constructor) {
  4 |     return true;

Looks like some server code runs in browser and, of course, breaks the app.

The issue is hard-to-debug, as the above error is the only useful in the stack, all the other point to webpack sources.

Any ideas?

yantakus commented 5 years ago

I fixed the issue by upgrading graphql from 0.13.2 to the latest version (14.2.1 ATM). Seems to be a fixed bug in graphql package.