graphql-docs icon indicating copy to clipboard operation
graphql-docs copied to clipboard

Isomorphic apps

Open jmatsushita opened this issue 9 years ago • 1 comments
trafficstars

Hi there,

Thanks for the nice module. I've promoted it on SO

Any thoughts on how to make it easier to use it in an isomorphic app context? On the server side I get:

***/node_modules/graphql-docs/dist/webpack:/~/style-loader/addStyles.js:31
 	if (typeof options.singleton === "undefined") options.singleton = isOldIE();
 ^
 ReferenceError: window is not defined

Maybe related to #4 ?

Cheers,

Jun

jmatsushita avatar Oct 31 '16 15:10 jmatsushita

FYI I've worked around this problem in the following way:

  if (typeof window != "undefined") {
    const GraphQLDocs = require('graphql-docs').GraphQLDocs;
    return <GraphQLDocs fetcher={fetcher} />
  } else {
    return <div></div>
  }

jmatsushita avatar Oct 31 '16 16:10 jmatsushita