Import graphql-ws fails

Please help with importing

import {createClient} from 'https://cdn.skypack.dev/graphql-ws@5.11.2'

results in error ( e is not a function ) or Runtime error.

This module loads in the browser ( Chrome ) with no error.

If it is not possible, please advice on how to use GraphQL subscriptions in ObservableHQ.

I found this solution

graphqlWs = require("https://unpkg.com/graphql-ws/umd/graphql-ws.min.js")

Hi Aleksey. Have you seen Module require debugger / Observable | Observable? It can help in these situations where an import fails; maybe you have.

Observable uses the import {this} from "that" syntax for cross-notebook imports, so it won’t work for importing ES modules. (Annoying, but the Observable syntax predates browser support for ES modules.) But you can do dynamic imports of ES modules, like:

graphqlWs = import('https://cdn.skypack.dev/graphql-ws@5.13.1?min')

That seems to work for me, as does your second example (requiring from unpkg). As least as far as the client library loads without errors; I haven’t tested with a server. Does that help?