Skip to content

Instantly share code, notes, and snippets.

@modster
Created November 16, 2021 05:41
Show Gist options
  • Save modster/d6bf5aedabce68c1d8db367f6ab6d53c to your computer and use it in GitHub Desktop.
Save modster/d6bf5aedabce68c1d8db367f6ab6d53c to your computer and use it in GitHub Desktop.
Using GraphQL in a Browser

Using GraphQL in a Browser

GraphQL.js is a general-purpose library and can be used both in a Node server and in the browser. As an example, the GraphiQL tool is built with GraphQL.js!

Building a project using GraphQL.js with webpack or rollup should just work and only include the portions of the library you use. This works because GraphQL.js is distributed with both CommonJS (require()) and ESModule (import) files. Ensure that any custom build configurations look for .mjs files!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment