🏠 back to Observable

request for nmp graphql module

I have tried all suggestions for require of the npm graphql module
I have tried:

graphql = require(“graphql@14.6.0”)

graphql = require(" https://cdn.jsdelivr.net/npm/graphql@14.6.0/dist/graphql.js")

and other variants (could not add them to this post due to limit of two links by new users imposed by the forum)

I get the following error:

graphql = Le: unable to load module

I am able to load the module just fine when running on a standalone Node.js module.

I would greatly appreciate any ideas/suggestion on what to do.

Thanks in advance

REM Martin

Hi @Rem-Martin ,

I’m not sure if that specific package is ready for run on your browser. It seems like it’s intend to be used with node, you can read more on this discussion.

But if you’re looking for a lightweight graphql client that runs on your browser, maybe you can try graphql.js

Here is one example on observable

Thank you @radames

I will read the materials you have provided.

Indeed the graphql-js is only written for node.js and not for the browser.
I have been trying to convert it via rollup but I have not been fully successful.

I was not able to use your graphql example, given that I am trying to convert the SDL schema into a GraphQL.js GraphQLSchema object as described here:


unfortunately for me, it only works on NPM

Thank you for your lead